🚀 DAY 5 OF LAUNCH WEEK: Introducing Socket Firewall Enterprise.Learn more →
Socket
Book a DemoInstallSign in
Socket

silent-error

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

silent-error

stackless unless otherwise requested error

latest
Source
npmnpm
Version
1.1.1
Version published
Weekly downloads
278K
79.79%
Maintainers
1
Weekly downloads
 
Created
Source

silent-error Build Status

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

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 SilentError(`command: '${name}' is not installed`);
}
// in another node_module
async function caller() {

  try {
    await runCommand('foo');
  } catch(e) {
    SilentError.debugOrThrow(e);
  }

  SilentError.debugOrThrow
}

Installation

yarn add silent-error

or

npm install --save silent-error

FAQs

Package last updated on 10 Oct 2018

Did you know?

Socket

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.

Install

Related posts