Home
Docs
GitHub
Pricing
Blog
Log In

Run Sandworm Audit for your App

Get started
Hold on, we're currently generating a fresh version of this report
Generated on Feb 29, 2024 via pnpm

verror 1.10.0

richer JavaScript errors
Package summary
Share
0
issues
1
license
4
MIT
Package created
18 Apr 2012
Version published
2 May 2017
Maintainers
10
Total deps
4
Direct deps
3
License
MIT

Issues

0
This package has no issues

Licenses

MIT License

Permissive
OSI Approved
This is a human-readable summary of (and not a substitute for) the license. Disclaimer.
Can
commercial-use
modify
distribute
sublicense
private-use
Cannot
hold-liable
Must
include-copyright
include-license
4 Packages, Including:
assert-plus@1.0.0
core-util-is@1.0.2
extsprintf@1.4.1
verror@1.10.0
Disclaimer

This deed highlights only some of the key features and terms of the actual license. It is not a license and has no legal value. You should carefully review all of the terms and conditions of the actual license before using the licensed material.

Sandworm is not a law firm and does not provide legal services. Distributing, displaying, or linking to this deed or the license that it summarizes does not create a lawyer-client or any other relationship.

Direct Dependencies

3
All Dependencies CSV
ⓘ This is a list of verror 's direct dependencies. Data on all dependencies, including transitive ones, is available via CSV download.
NameVersionSizeLicenseTypeVulnerabilities
assert-plus1.0.03.85 kBMIT
prod
core-util-is1.0.26.85 kBMIT
prod
extsprintf1.4.110.72 kBMIT
prod

Visualizations

Frequently Asked Questions

What does verror do?

Verror is a Node.js library that enhances and enriches the capability of JavaScript in handling errors. This library offers various classes that support printf-style arguments for easier message readability, chains of causes that enable tracking of errors from initial point to the final error point, extra properties to supply more information about the error, and the creation of personalized subclasses that come with full support.

How do you use verror?

To use verror, first, install the package using npm:

npm install verror

Verror can be used as a replacement for JavaScript Error class. It offers additional features such as printf-style messages:

var VError = require('verror');
var err = new VError('missing file: "%s"', '/etc/passwd');
console.log(err.message);

It also supports chaining of errors while maintaining each error’s message:

var VError = require('verror');
var fs = require('fs');
var filename = '/nonexistent';
fs.stat(filename, function (err1) {
	var err2 = new VError(err1, 'stat "%s"', filename);
	console.error(err2.message);
});

You can get the next-level error using err.cause():

console.error(err2.cause().message);

Chaining of errors can be done as many times you want:

var err1 = new Error('No such file or directory');
var err2 = new VError(err1, 'failed to stat "%s"', '/junk');
var err3 = new VError(err2, 'request failed');
console.error(err3.message);

This will print: request failed: failed to stat "/junk": No such file or directory

Where are the verror docs?

The official documentation for Verror can be found in the readme of the repository: https://github.com/joyent/node-verror. The readme contains comprehensive information on how to use the library, constructors, properties and methods of the VError, WError, SError, and MultiError classes, as well as practical examples of how to use them.