How to use pug-error - 3 common examples

To help you get started, we’ve selected a few pug-error examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github pugjs / babel-plugin-transform-react-pug / src / context.js View on Github external
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);
  }
github pugjs / babel-plugin-transform-react-pug / src / code-gen.js View on Github external
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 {
github pugjs / pug / packages / pug-linker / index.js View on Github external
function error() {
  throw require('pug-error').apply(null, arguments);
}

pug-error

Standard error objects for pug

MIT
Latest version published 7 months ago

Package Health Score

86 / 100
Full package analysis

Popular pug-error functions