Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

raz

Package Overview
Dependencies
Maintainers
1
Versions
96
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

raz - npm Package Compare versions

Comparing version 0.0.9 to 0.0.10

core/errors/RazorError.js

62

core/errors/errors.en.js

@@ -1,2 +0,2 @@

const ParserError = require('./ParserError');
const RazorError = require('./RazorError');

@@ -11,3 +11,3 @@

var message = `End-of-file was found after the "@" character at line ${lineNum + 1} pos ${posNum + 1}. "@" must be followed by a valid code block. If you want to output an "@", escape it using the sequence: "@@"`;
return new ParserError(message, this.args, lineNum, posNum);
return new RazorError(message, this.args, lineNum, posNum);
}

@@ -17,3 +17,3 @@

var message = `unexpected '${ch}' character at line ${lineNum + 1} pos ${posNum + 1} after '${line}' <--`;
return new ParserError(message, this.args, lineNum, posNum);
return new RazorError(message, this.args, lineNum, posNum);
}

@@ -23,3 +23,3 @@

var message = `unexpected '@' character at line ${lineNum + 1} pos ${posNum + 1}. Once inside the body of a code block (@if {}, @{}, etc.) or a section (@section{}) you do not need to use "@{" to switch to code.`;
return new ParserError(message, this.args, lineNum, posNum);
return new RazorError(message, this.args, lineNum, posNum);
}

@@ -29,3 +29,3 @@

var message = `"${ch}" is not valid at the start of a code block at line ${lineNum + 1} pos ${posNum + 1}. Only identifiers, keywords, "(" and "{" are valid.`;
return new ParserError(message, this.args, lineNum, posNum);
return new RazorError(message, this.args, lineNum, posNum);
}

@@ -35,3 +35,3 @@

var message = `Unexpected end of file after "${text}" <--`;
return new ParserError(message, this.args);
return new RazorError(message, this.args);
}

@@ -41,3 +41,3 @@

var message = `'${ch}' character is expected at line ${line + 1} pos ${pos + 1}.`;
return new ParserError(message, this.args, line, pos);
return new RazorError(message, this.args, line, pos);
}

@@ -47,3 +47,3 @@

var message = `The explicit expression "${expr}" is missing a closing character "${ch}" at line ${line + 1} pos ${pos + 1}.`;
return new ParserError(message, this.args, line, pos);
return new RazorError(message, this.args, line, pos);
}

@@ -53,3 +53,3 @@

var message = `The code or section block is missing a closing "}" character. Make sure you have a matching "}" character for all the "{" characters within this block, and that none of the "}" characters are being interpreted as markup. The block starts at line ${line + 1} with text: "${codeFirstLine}"`;
return new ParserError(message, this.args, line);
return new RazorError(message, this.args, line);
}

@@ -59,3 +59,3 @@

var message = `"${ch}" is not a valid HTML character at line ${lineNum} pos ${posNum}` + (afterText ? ` after "${afterText}" < --` : expected ? ` (expected char = "${expected}")` : '.');
return new ParserError(message, this.args, lineNum, posNum);
return new RazorError(message, this.args, lineNum, posNum);
}

@@ -65,3 +65,3 @@

var message = `'${tag}' tag at line ${line + 1} pos ${pos + 1} is missing mathing start tag: '${html}' <--`;
return new ParserError(message, this.args, line, pos, tag.length);
return new RazorError(message, this.args, line, pos, tag.length);
}

@@ -71,3 +71,3 @@

var message = `'${tag}' tag at line ${line + 1} pos ${pos + 1} is missing mathing end tag: '${html}' <--`;
return new ParserError(message, this.args, line, pos, tag.length);
return new RazorError(message, this.args, line, pos, tag.length);
}

@@ -77,3 +77,3 @@

var message = `Invalid "${ch}" symbol in expression at line ${line + 1} pos ${pos + 1} after "${afterText}" <--`;
return new ParserError(message, this.args, line, pos);
return new RazorError(message, this.args, line, pos);
}

@@ -83,3 +83,3 @@

var message = `Invalid HTML-tag: '${tag}'`;
return new ParserError(message, this.args);
return new RazorError(message, this.args);
}

@@ -89,3 +89,3 @@

var message = `The file "${viewName}" is not available.`;
return new ParserError(message, this.args);
return new RazorError(message, this.args);
}

@@ -95,3 +95,3 @@

var message = `A whitespace expected after the "${keyword}" keyword at line ${line + 1} pos ${pos + 1}.`;
return new ParserError(message, this.args, line, pos);
return new RazorError(message, this.args, line, pos);
}

@@ -101,3 +101,3 @@

var message = `Tag name expected at line ${line + 1} pos ${pos + 1}: '${html}' <--`;
return new ParserError(message, this.args, line, pos);
return new RazorError(message, this.args, line, pos);
}

@@ -107,3 +107,3 @@

var message = `A section name expected after the "${keyword}" keyword at line ${line + 1} pos ${pos + 1}.`;
return new ParserError(message, this.args, line, pos);
return new RazorError(message, this.args, line, pos);
}

@@ -113,3 +113,3 @@

var message = `A section name cannot start with '${ch}' at line ${line + 1} pos ${pos + 1}.`;
return new ParserError(message, this.args, line, pos);
return new RazorError(message, this.args, line, pos);
}

@@ -119,3 +119,3 @@

var message = `A section name cannot include '${ch}' character at line ${line + 1} pos ${pos + 1}.`;
return new ParserError(message, this.args, line, pos);
return new RazorError(message, this.args, line, pos);
}

@@ -125,3 +125,3 @@

var message = `Unexpected literal '${ch}' following the 'section' directive at line ${line + 1} pos ${pos + 1}. Expected '{'.`;
return new ParserError(message, this.args, line, pos);
return new RazorError(message, this.args, line, pos);
}

@@ -131,3 +131,3 @@

var message = `The section '${sectionName}' at line ${line + 1} pos ${pos + 1} has been already defined.`;
return new ParserError(message, this.args, line, pos);
return new RazorError(message, this.args, line, pos);
}

@@ -137,3 +137,3 @@

var message = `The section block '${sectionName}' is missing a closing "}" character.`;
return new ParserError(message, this.args);
return new RazorError(message, this.args);
}

@@ -143,3 +143,3 @@

var message = `Section blocks cannot be nested at line ${line + 1} pos ${pos + 1}.`;
return new ParserError(message, this.args, line, pos);
return new RazorError(message, this.args, line, pos);
}

@@ -149,3 +149,3 @@

var message = `The view '${filePath}' requires the section '${sectionName}' which cannot be found.`;
return new ParserError(message, this.args);
return new RazorError(message, this.args);
}

@@ -155,3 +155,3 @@

var message = `The section '${sectionName}' has already been rendered by '${renderedBy}'. There is an atempt to rendered it again by '${attemptedBy}'.`;
return new ParserError(message, this.args);
return new RazorError(message, this.args);
}

@@ -161,3 +161,3 @@

let message = `The view "${this.args.filename}" cannot find the partial view "${partialView}".\nThe following locations were searched:\n${searchedLocations.join("\n")}.`;
return new ParserError(message, this.args);
return new RazorError(message, this.args);
}

@@ -167,3 +167,3 @@

let message = `Reading file '${this.args.filename}' caused an error: ${error}`;
let parserError = new ParserError(message, this.args);
let parserError = new RazorError(message, this.args);
setInnerError(parserError, error);

@@ -175,3 +175,3 @@ return parserError;

let message = `Reading view file '${filename}' caused an error: ${error}`;
let parserError = new ParserError(message, this.args);
let parserError = new RazorError(message, this.args);
setInnerError(parserError, error);

@@ -183,3 +183,3 @@ return parserError;

let message = "Partial layout name is expected."
return new ParserError(message, this.args);
return new RazorError(message, this.args);
}

@@ -193,3 +193,3 @@

customError(error) {
return new ParserError(error, this.args);
return new RazorError(error, this.args);
}

@@ -196,0 +196,0 @@ }

@@ -264,3 +264,3 @@ 'use strict';

const ParserError = require('./errors/ParserError');
const RazorError = require('./errors/RazorError');
const ErrorsFactory = require('./errors/errors');

@@ -1203,3 +1203,3 @@ const path = require('path');

function toParserError(err, errorFactory) {
if (err instanceof ParserError)
if (err instanceof RazorError)
return err;

@@ -1206,0 +1206,0 @@

@@ -1,2 +0,2 @@

# The overview of Razor-Express
# The overview of Razor-Express view template engine

@@ -3,0 +3,0 @@ Let's first quickly look at the key concepts and terms.

{
"name": "raz",
"description": "Razor-like syntax for templating views in Express framework by mixing HTML with JavaScript.",
"version": "0.0.9",
"version": "0.0.10",
"author": {

@@ -6,0 +6,0 @@ "name": "Sergey",

@@ -16,3 +16,3 @@ ////////////////////////////////////////////

const Razor = require("../core/Razor");
const ParserError = require('../core/errors/ParserError');
const RazorError = require('../core/errors/RazorError');
//const ErrorFactory = require('../core/errors/errors');

@@ -148,3 +148,3 @@

expect(html).not.to.exist;
expect(err).to.be.an.instanceOf(ParserError);
expect(err).to.be.an.instanceOf(RazorError);
expect(err.message).to.have.string(`The view "${viewName}" cannot find the partial view "_partial.raz".`);

@@ -221,3 +221,3 @@ done();

expect(err).to.exist;
expect(err).to.be.an.instanceOf(ParserError);
expect(err).to.be.an.instanceOf(RazorError);
expect(err.inner).to.exist;

@@ -231,3 +231,3 @@ expect(err.inner.code).to.equal(errCode);

expect(err).to.exist;
expect(err).to.be.an.instanceOf(ParserError);
expect(err).to.be.an.instanceOf(RazorError);

@@ -234,0 +234,0 @@ if (method)

@@ -5,3 +5,3 @@ //'use strict';

args = args || {};
const ParserError = require('../core/errors/ParserError');
const RazorError = require('../core/errors/RazorError');
const path = require('path');

@@ -85,3 +85,3 @@ const app = require('express')();

if (env !== "production" && err instanceof ParserError) {
if (env !== "production" && err instanceof RazorError) {
var errorHtml = err.getHtml();

@@ -88,0 +88,0 @@ res.status(500);

@@ -142,3 +142,3 @@ console.log("STARTED: server.test.js");

expect(h1.text()).to.have.string("An error occurred during the compilation of a 'razor-syntax' page required to process this request.");
let layouts = $(`:contains(ParserError: The view "invalid.raz" cannot find the partial view)`);
let layouts = $(`:contains(RazorError: The view "invalid.raz" cannot find the partial view)`);
expect(layouts, "error message").to.have.lengthOf.above(0);

@@ -145,0 +145,0 @@ console.log(`> testing rote "/invalid"...done`);

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc