Closed convers39 closed 1 month ago
my current walkaround with a type guard
export const isAggregateError = (error: unknown): error is AggregateError => {
return (
error instanceof Error &&
error.name.startsWith('AggregateError') &&
'errors' in error &&
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)
@aleclarson Thank you for following up! Will migrate to Radashi then!
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
.