5.0.0 • Published 7 months ago

aggregate-error v5.0.0

Weekly downloads
11,423,390
License
MIT
Repository
github
Last release
7 months ago

aggregate-error

Create an error from multiple errors

Note: With Node.js 15, there's now a built-in AggregateError type.

Install

npm install aggregate-error

Usage

import AggregateError from 'aggregate-error';

const error = new AggregateError([new Error('foo'), 'bar', {message: 'baz'}]);

throw error;
/*
AggregateError:
    Error: foo
        at Object.<anonymous> (/Users/sindresorhus/dev/aggregate-error/example.js:3:33)
    Error: bar
        at Object.<anonymous> (/Users/sindresorhus/dev/aggregate-error/example.js:3:13)
    Error: baz
        at Object.<anonymous> (/Users/sindresorhus/dev/aggregate-error/example.js:3:13)
    at AggregateError (/Users/sindresorhus/dev/aggregate-error/index.js:19:3)
    at Object.<anonymous> (/Users/sindresorhus/dev/aggregate-error/example.js:3:13)
    at Module._compile (module.js:556:32)
    at Object.Module._extensions..js (module.js:565:10)
    at Module.load (module.js:473:32)
    at tryModuleLoad (module.js:432:12)
    at Function.Module._load (module.js:424:3)
    at Module.runMain (module.js:590:10)
    at run (bootstrap_node.js:394:7)
    at startup (bootstrap_node.js:149:9)
*/

for (const individualError of error.errors) {
	console.log(individualError);
}
//=> [Error: foo]
//=> [Error: bar]
//=> [Error: baz]

API

AggregateError(errors)

Returns an Error.

errors

Type: Array<Error|object|string>

If a string, a new Error is created with the string as the error message.\ If a non-Error object, a new Error is created with all properties from the object copied over.

@june21x/semantic-release-github-no-commentarchetype-librarycomponennentt@segment/actions-coreeasy-select-rnvuedragdropuploadimages@iharob/graphql-mesh-thriftreact-native-bluetooth2killi8n-react-native-fast-imagesemantic-release-vagrant-2@jakeblaxon-graphql-mesh/json-schema@jakeblaxon-graphql-mesh/thrift@iharob/graphql-mesh-json-schema@clipchamp/semantic-release-gitairscanairscan-examplebb-chat@semantic-release-expo/publishreact-native-esc-pos-sahaabsemantic-github-pullrequest@borisovart/atol-kkt-moduledeneme323112@texttree/demo-bsa-reference-rcl@fundefund/funde_ck@ntt_app/react-native-custom-notification@educationperfect/semantic-releasereact-native-covid-sdk@jttechnic/interpreter@saeon/quick-form@nona-creative/semantic-release-latest-release-notesreact-native-printer-brothers@newhorizon-tech/dd-npm-package-templatereact-native-shekhar-bridge-testcogoportutilslevibestliblevibestlib2levilibtest19levilibtest24levilibtest25levilibtest26levilibtest27levilibtest28levilibtest29@oiti/documentoscopy-react-native@mink-opn/build-tokensquoc-testcclibyarntest@saaspe/componentsexpand-react-bridgenode-gioluminos-ui-corerenovate@everything-registry/sub-chunk-1105jawwy-sdkjawwy_gamification_releasereact-native-sphereuisphereuijawwy_libraryreact-native-credit-card-pkg@rabailriaz/hisaab-web-portalreact-native-jawwy_sample@geeky-apo/react-native-advanced-clipboardlib-errorlevilibtest15levilibtest16levilibtest17levilibtest18levilibtest21levilibtest22levilibtest23levimultiplatform10levimultiplatformtestlevimultitestlevikotlinliblevikotlintesthot-zone-vuekartoffeldruckkhaled-salem-custom-componentsknightxv-libp2pgogency-test-2gogencylabtesttwolaoitdev-core-pluginslattics-remotely-savelentolento_customjesusdemojest-ban-consolejeuxuijordy-frijters-test-libmonorepo-semantic-releaseng-search-dropdownmt-delete-release-testmiracle-webpack-tree-shakingmssql-pool-partyjson-api-errorjrennsoh88-react-native-scroll-indicatornative-date-picker-modulenative-modal-damage-vehiclenative-kakao-login
5.0.0

7 months ago

4.0.1

2 years ago

4.0.0

3 years ago

3.1.0

4 years ago

3.0.1

4 years ago

3.0.0

5 years ago

2.2.0

5 years ago

2.1.0

5 years ago

2.0.0

5 years ago

1.0.0

7 years ago

0.1.0

8 years ago