Socket
Book a DemoInstallSign in
Socket

error-cause

Package Overview
Dependencies
Maintainers
1
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

error-cause

An ES-spec-compliant shim/polyfill/replacement for the `.cause` property on all Error types that works as far down as ES3

latest
Source
npmnpm
Version
1.0.9
Version published
Weekly downloads
12K
-40.6%
Maintainers
1
Weekly downloads
 
Created
Source

error-cause Version Badge

github actions coverage dependency status dev dependency status License Downloads

npm badge

An ES-spec-compliant shim/polyfill/replacement for the .cause property on all Error types that works as far down as ES3

This package implements the es-shim API “multi” interface. It works in an ES3-supported environment and complies with the proposed spec.

Getting started

npm install --save error-cause

Usage/Examples

const assert = require('assert');

require('error-cause/auto');

try {
		x();
} catch (e) {
		const actual = new Error('a better message!', { cause: e });
		assert(actual instanceof Error);
		assert(actual.cause === e);
}

Tests

Clone the repo, npm install, and run npm test

Keywords

javascript

FAQs

Package last updated on 12 Sep 2025

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