
Security News
Crates.io Users Targeted by Phishing Emails
The Rust Security Response WG is warning of phishing emails from rustfoundation.dev targeting crates.io users.
An extension of the native Error class that adds support for additional properties, simple assertions and can be extended as any other ES6 class.
Erratum is an extension of the native Error class that adds support for additional properties, simple assertions and can be extended as any other ES6 class.
new Erratum([data], message)
Arguments:
Quick example:
const Erratum = require('erratum');
const err = new Erratum({statusCode: 500}, 'The answer is: 42');
err instanceof Error // true
err instanceof Erratum // true
err.statusCode === 500 // true
err.message === 'This answer is: 42'; // true
Erratum
can be extended as any other ES6 class.
class ExtendedErratum extends Erratum {};
const err = new ExtendedErratum({statusCode: 500}, 'The answer is: 42');
err instanceof Error // true
err instanceof Erratum // true
err instanceof ExtendedErratum // true
err.statusCode === 500 // true
err.message === 'This answer is: 42'; // true
If data
is an instance of Error
or has either the err
property or the error
property set to an instance of Error
, the stack of the new Erratum
instance will incorporate the stack of the provided error. The latter will be available through the wrappedError
property.
const err = new Error('Something went wrong.');
throw new Erratum({err}, 'Yes, something definitely went wrong.');
Erratum: Yes, something definitely went wrong.
at repl:1:7
at REPLServer.defaultEval (repl.js:262:27)
at bound (domain.js:287:14)
at REPLServer.runBound [as eval] (domain.js:300:12)
at REPLServer.<anonymous> (repl.js:431:12)
at emitOne (events.js:82:20)
at REPLServer.emit (events.js:169:7)
at REPLServer.Interface._onLine (readline.js:211:10)
at REPLServer.Interface._line (readline.js:550:8)
at REPLServer.Interface._ttyWrite (readline.js:827:14)
Caused By: Error: Something went wrong.
at repl:1:17
at REPLServer.defaultEval (repl.js:262:27)
at bound (domain.js:287:14)
at REPLServer.runBound [as eval] (domain.js:300:12)
at REPLServer.<anonymous> (repl.js:431:12)
at emitOne (events.js:82:20)
at REPLServer.emit (events.js:169:7)
at REPLServer.Interface._onLine (readline.js:211:10)
at REPLServer.Interface._line (readline.js:550:8)
at REPLServer.Interface._ttyWrite (readline.js:827:14)
Erratum
and all of its child classes support simple assertions through Erratum.assert()
.
Erratum.assert(check(), {statusCode: 500}, 'The answer is: 42');
Erratum.extend()
in favour of ES6' classesnew
)Error
class to better support error specializationErratum.wrap()
$ npm test
See LICENSE.
FAQs
An extension of the native Error class that adds support for additional properties, simple assertions and can be extended as any other ES6 class.
The npm package erratum receives a total of 0 weekly downloads. As such, erratum popularity was classified as not popular.
We found that erratum demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
The Rust Security Response WG is warning of phishing emails from rustfoundation.dev targeting crates.io users.
Product
Socket now lets you customize pull request alert headers, helping security teams share clear guidance right in PRs to speed reviews and reduce back-and-forth.
Product
Socket's Rust support is moving to Beta: all users can scan Cargo projects and generate SBOMs, including Cargo.toml-only crates, with Rust-aware supply chain checks.