You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
/** * Support for the built-in AggregateError * is still new. Node < 15 doesn't have it * so patching here. * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/AggregateError#browser_compatibility */exportclassAggregateErrorextendsError{errors: Error[]constructor(errors: Error[]=[]){super()constname=errors.find(e=>e.name)?.name??''this.name=`AggregateError(${name}...)`this.message=`AggregateError with ${errors.length} errors`this.stack=errors.find(e=>e.stack)?.stack??this.stackthis.errors=errors}}
exportconstisAggregateError=(error: unknown): error is AggregateError=>{return(errorinstanceofError&&error.name.startsWith('AggregateError')&&'errors'inerror&&Array.isArray(error.errors));};
Hello @convers39. Over at the Radashi fork, we've fixed this issue by using globalThis.AggregateError when it's available (see #116). You can use it today by installing radashi@beta. (An official release is pending)
As per the native AggregateError examples:
We can use
instanceof
to check if the error is an AggregateError.Currently
instanceof
does not catch the patched version:https://github.com/rayepps/radash/blob/master/src/async.ts#L88-L104
This could be done by adding:
But not sure if the current implementation is intended, or if is there any recommended walkaround to catch an
AggregateError
.The text was updated successfully, but these errors were encountered: