Security News
pnpm 10.0.0 Blocks Lifecycle Scripts by Default
pnpm 10 blocks lifecycle scripts by default to improve security, addressing supply chain attack risks but sparking debate over compatibility and workflow changes.
aggregate-error-ponyfill
Advanced tools
The
AggregateError
object represents an error when several errors need to be wrapped in a single error. It is thrown when multiple errors need to be reported by an operation, for example byPromise.any()
, when all promises passed to it reject.
npm install aggregate-error-ponyfill --save
import AggregateError from 'aggregate-error-ponyfill';
(async () => {
try {
await Promise.any([Promise.reject(new Error('some error'))]);
} catch (e) {
console.log(e instanceof AggregateError); // true
console.log(e.message); // "All Promises rejected"
console.log(e.name); // "AggregateError"
console.log(e.errors); // [ Error: "some error" ]
}
})();
try {
throw new AggregateError([new Error('some error')], 'Hello');
} catch (e) {
console.log(e instanceof AggregateError); // true
console.log(e.message); // "Hello"
console.log(e.name); // "AggregateError"
console.log(e.errors); // [ Error: "some error" ]
}
You can use named export preferNative
if you wish to use native
implementation if it’s available. In all other cases, ponyfill will be used.
Beware of
caveats!
Returns: AggregateError
Method description.
Type: Iterable
An iterable of errors, may not actually be Error
instances.
Type: string
An optional human-readable description of the aggregate error.
Tested in IE11+ and all modern browsers.
It works in older IE versions such as IE9, but you can’t test for
instanceof AggregateError
due to
proper subclassing of native classes.
Test suite is taken and modified from
es-shims/AggregateError
polyfill.
For automated tests, run npm run test:automated
(append :watch
for watcher
support).
MIT © Ivan Nikolić
[1.1.0][] - 2020-12-17
preferNative
FAQs
AggregateError ponyfill.
The npm package aggregate-error-ponyfill receives a total of 289 weekly downloads. As such, aggregate-error-ponyfill popularity was classified as not popular.
We found that aggregate-error-ponyfill demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
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.
Security News
pnpm 10 blocks lifecycle scripts by default to improve security, addressing supply chain attack risks but sparking debate over compatibility and workflow changes.
Product
Socket now supports uv.lock files to ensure consistent, secure dependency resolution for Python projects and enhance supply chain security.
Research
Security News
Socket researchers have discovered multiple malicious npm packages targeting Solana private keys, abusing Gmail to exfiltrate the data and drain Solana wallets.