pug-error

WebJar for pug-error

License

License

MIT
GroupId

GroupId

org.webjars.npm
ArtifactId

ArtifactId

pug-error
Last Version

Last Version

1.3.2
Release Date

Release Date

Type

Type

jar
Description

Description

pug-error
WebJar for pug-error
Project URL

Project URL

http://webjars.org
Source Code Management

Source Code Management

https://github.com/pugjs/pug-error

Download pug-error

How to add to project

<!-- https://jarcasting.com/artifacts/org.webjars.npm/pug-error/ -->
<dependency>
    <groupId>org.webjars.npm</groupId>
    <artifactId>pug-error</artifactId>
    <version>1.3.2</version>
</dependency>
// https://jarcasting.com/artifacts/org.webjars.npm/pug-error/
implementation 'org.webjars.npm:pug-error:1.3.2'
// https://jarcasting.com/artifacts/org.webjars.npm/pug-error/
implementation ("org.webjars.npm:pug-error:1.3.2")
'org.webjars.npm:pug-error:jar:1.3.2'
<dependency org="org.webjars.npm" name="pug-error" rev="1.3.2">
  <artifact name="pug-error" type="jar" />
</dependency>
@Grapes(
@Grab(group='org.webjars.npm', module='pug-error', version='1.3.2')
)
libraryDependencies += "org.webjars.npm" % "pug-error" % "1.3.2"
[org.webjars.npm/pug-error "1.3.2"]

Dependencies

There are no dependencies for this project. It is a standalone project that does not depend on any other jars.

Project Modules

There are no modules declared in this project.

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

var 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:

  • filename: the name of the file causing the error
  • line: the offending line
  • column: the offending column
  • src: the Pug source, if available, for pretty-printing the error context

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.

var error = require('pug-error');

var 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' }

throw err;

License

MIT

org.webjars.npm

Pug

Versions

Version
1.3.2