Unpack Aggregate Errors

This commit is contained in:
Enrico Ros
2024-11-03 15:59:18 -08:00
parent 9bacedb48c
commit 0f8fda5c43
+6
View File
@@ -50,6 +50,12 @@ export function safeErrorString(error: any): string | null {
if (!error)
return null;
// handle AggregateError
if (error instanceof AggregateError) {
const errors = error.errors.map(e => safeErrorString(e)).filter(Boolean);
return `AggregateError: ${errors.join('; ')}`;
}
// descend into an 'error' object
if (error.error)
return safeErrorString(error.error);