Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

error-cause

es-shims72.2kMIT1.0.8TypeScript support: definitely-typed

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

javascript, polyfill, ecmascript, error, shim, syntaxerror, typeerror, referenceerror, aggregateerror, rangeerror, evalerror, urierror

readme

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

changelog

Changelog

All notable changes to this project will be documented in this file.

The format is based on Keep a Changelog and this project adheres to Semantic Versioning.

v1.0.8 - 2024-03-16

Commits

  • [Deps] update call-bind, es-abstract, has-property-descriptors f32d2c2
  • [Dev Deps] update tape 8306def

v1.0.7 - 2024-02-05

Commits

  • [Refactor] use es-errors where possible, so things that only need those do not need get-intrinsic 594cdae
  • [Deps] update call-bind, define-properties, es-abstract, es-aggregate-error, get-intrinsic, has-property-descriptors 2353b34
  • [Dev Deps] update aud, function.prototype.name, npmignore, tape d9d2cb7

v1.0.6 - 2023-08-27

Commits

  • [Deps] update define-properties, es-abstract, es-aggregate-error, get-intrinsic 838666c
  • [Dev Deps] update @es-shims/api, @ljharb/eslint-config, aud, tape a2ae385

v1.0.5 - 2022-11-07

Commits

  • [Deps] update es-abstract, es-aggregate-error, get-intrinsic, globalthis 7674ed8
  • [actions] update rebase action to use reusable workflow 3035aa1
  • [Dev Deps] update aud, tape 65cb74b

v1.0.4 - 2022-05-04

Commits

  • [meta] use npmignore to autogenerate an npmignore file 4172ae5
  • [Fix] ensure constructor prototypes are nonwritable 735bfa3
  • [Dev Deps] update eslint, @ljharb/eslint-config, auto-changelog, tape 1d472b6
  • [Dev Deps] update eslint, @ljharb/eslint-config, aud, tape 8042125
  • [patch] add comment for v8 bug 6924f48
  • [Deps] update define-properties, es-abstract 69fc186

v1.0.3 - 2021-12-17

Commits

  • [Fix] constructor property must be non-enumerable a1de915
  • [Dev Deps] update eslint, @ljharb/eslint-config 0bb890a

v1.0.2 - 2021-12-05

Commits

  • [actions] reuse common workflows a2a7c51
  • [Dev Deps] update eslint, @ljharb/eslint-config, safe-publish-latest, tape b28b1b2
  • [actions] update codecov uploader 77dd54f
  • [Deps] move evalmd to dev dependency 7079c9d

v1.0.1 - 2021-10-04

Fixed

  • [readme] use an actual Error as the cause #2

Commits

  • [meta] add missing "exports" entries b8cf2da
  • [Deps] update es-abstract, es-aggregate-error b87af6f
  • [Tests] add @es-shims/api 05ff5db
  • [Dev Deps] update function.prototype.name b212d83

v1.0.0 - 2021-09-23

Commits