Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

chained-error

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

chained-error

Zero dependencies error that allows creating a chain of errors, preserving the original cause (with TypeScript support)

  • 1.0.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

chained-error

npm minified size minified & gziped size

Zero dependencies error that allows creating a chain of errors, preserving the original cause (with TypeScript support)

Install

Install with npm:

$ npm install --save chained-error

Basic usage

import ChainedError from 'chained-error';

// ...
try {
    // ...
} catch (error) {
    throw new ChainedError('My message', error);
}

Later, when you catch the error, and you print it, you will see something like it:

ChainedError: My message
    at ...
    at ...
    at ...
Caused By: TheOtherErrorType: The other error message
    at ...
    at ...
    at ...

Type definition

export default class ChainedError extends Error {
    cause: any;
    constructor(messageOrCause: any);
    constructor(message: string, cause: any);
}

License

MIT

Keywords

FAQs

Package last updated on 14 Aug 2019

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc