Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
error(code: string, message: string): Error {
const options: Object = {
filename: this.file.opts.filename,
line: getCurrentLocation().start.line - 1,
src: null,
};
if (existsSync(options.filename)) {
options.src = readFileSync(this.file.opts.filename, 'utf8');
}
return error(code, message, options);
}
function onUpdate() {
if (enabled && parentEnabled && localKey) {
while (pending.length) {
pending.shift()(withString(join(parentKey, localKey), t.stringLiteral(':' + (index++))));
}
} else if (enabled && parentEnabled) {
const err = error('MISSING_KEY', 'You must specify a key for the first item in any loops.', {
line: path.node.loc.start.line + lineNumber,
filename: 'pug',
src: code,
});
throw err;
}
}
return {
function error() {
throw require('pug-error').apply(null, arguments);
}