pugjs/pug-error

Name: pug-error

Owner: Pug

Description: Standard error objects for pug

Created: 2015-07-20 15:09:10.0

Updated: 2017-02-02 18:27:55.0

Pushed: 2016-06-02 16:59:23.0

Homepage:

Size: 12

Language: JavaScript

GitHub Committers

UserMost Recent Commit# Commits

Other Committers

UserEmailMost Recent Commit# Commits

README

pug-error

Standard error objects for pug. This module is intended for use by the lexer, parser, loader, linker, code-generator and any plugins.

Build Status Dependency Status NPM version

Installation
npm install pug-error
Usage
error = require('pug-error');
error(code, message, options)

Create a Pug error object.

code is a required unique code for the error type that can be used to pinpoint a certain error.

message is a human-readable explanation of the error.

options can contain any of the following properties:

The resulting error object is a simple Error object with additional properties given in the arguments.

Caveat: the message argument is stored in err.msg, not err.message, which is occupied with a better-formatted message.

error = require('pug-error');

err = error('MY_CODE', 'My message', {line: 3, filename: 'myfile', src: 'foo\nbar\nbaz\nbash\nbing'});
 code: 'PUG:MY_CODE',
 msg: 'My message',
 line: 3,
 column: undefined,
 filename: 'myfile',
 src: 'foo\nbar\nbaz\nbash\nbing',
 message: 'myfile:3\n    1| foo\n    2| bar\n  > 3| baz\n    4| bash\n    5| bing\n\nMy message' }

w err;
License

MIT


This work is supported by the National Institutes of Health's National Center for Advancing Translational Sciences, Grant Number U24TR002306. This work is solely the responsibility of the creators and does not necessarily represent the official views of the National Institutes of Health.