diff --git a/src/utils/index.ts b/src/utils/index.ts index 78129e3d..7a4cb880 100644 --- a/src/utils/index.ts +++ b/src/utils/index.ts @@ -52,13 +52,13 @@ export const exportedUris: Set = new Set(); export const identifierRegex = /^(?:%|\p{L})[\p{L}\d]*$/u; /** - * Return a string represenattion of `error`. + * Return a string representation of `error`. * If `error` is `undefined`, returns the empty string. */ export function stringifyError(error): string { try { - if (error instanceof AggregateError) { - // Need to stringify the inner errors + if (Array.isArray(error?.errors)) { + // Need to stringify the inner errors of an AggregateError const errs = error.errors.map(stringifyError).filter((s) => s != ""); return errs.length ? `AggregateError:\n- ${errs.join("\n- ")}` : ""; }