包详细信息

suppressed-error

es-shims81.6kMIT1.0.3

ES Proposal spec-compliant shim for SuppressedError

javascript, ecmascript, SuppressedError, Error

自述文件

suppressed-error Version Badge

github actions coverage License Downloads

npm badge

ES Proposal spec-compliant shim for SuppressedError. Invoke its "shim" method to shim SuppressedError if it is unavailable or noncompliant.

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

Most common usage:

var assert = require('assert');
var SuppressedError = require('suppressed-error');

var suppressedError = new RangeError('hi!');
var cause = new EvalError('oops');
var error = new SuppressedError(cause, suppressedError, 'this is a suppressed error');

assert.equal(error.error, cause); // this is the cause of the suppression
assert.equal(error.suppressed, suppressedError);
assert.equal(error.message, 'this is a suppressed error');

SuppressedError.shim(); // will be a no-op if not needed

assert.ok(new globalThis.SuppressedError(null, '', {}) instanceof SuppressedError);

Tests

Simply clone the repo, npm install, and run npm test

更新日志

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.3 - 2024-02-04

Commits

  • [Deps] update define-data-property, es-abstract, function-bind, get-intrinsic, has-property-descriptors 0607304
  • [Refactor] use es-errors where possible, so things that only need those do not need get-intrinsic d2b8b62
  • [Dev Deps] update aud, npmignore, tape 4331dd2

v1.0.2 - 2023-09-13

Commits

  • [Refactor] use set-function-name, define-data-property 83ca3b4
  • [Deps] update define-properties, set-function-name 358a448

v1.0.1 - 2023-09-01

Commits

  • [Deps] update define-properties, es-abstract, get-intrinsic 1d591e1
  • [Dev Deps] update @es-shims/api, @ljharb/eslint-config, aud, tape 3916837

v1.0.0 - 2023-01-31

Commits