silent-verror

0.0.1 • Public • Published

silent-verror Build Status

An error subclass for humanized (even more humanized) errors. This module allows for inter-module detection of errors which are fatal, but where a stacktrace by default provides negative value.

Inspired by (slight mod) silent-error but to use VError under the hood.

Some use-cases:

  • command in your CLI tool is missing
  • plugin to your build system is given invalid user-input.

Obviously stack traces can still be valuable. To view the stacks, the following environment variable can be set to true

SILENT_ERROR=verbose <run program>

Example

// in one node module
async function runCommand(name) {
   // some logic
   throw new SilentVError(`command: '${name}' is not installed`);
}
// in another node_module
async function caller() {
 
  try {
    await runCommand('foo');
  } catch(e) {
    SilentVError.debugOrThrow(e);
  }
 
  SilentVError.debugOrThrow
}

Installation

yarn add silent-verror

or

npm install --save silent-verror

Readme

Keywords

none

Package Sidebar

Install

npm i silent-verror

Weekly Downloads

3

Version

0.0.1

License

ISC

Unpacked Size

3.21 kB

Total Files

3

Last publish

Collaborators

  • nmccready