framework: fix unwrapAggregatedError

This commit is contained in:
undefined committed 2026-09-03 07:56:49 +00:00
1 parent 73b2e4d75d
commit a7a49bf791
4 files changed
+12 -8

No files matched your search

+8 -1
View File
@@ -170,8 +170,15 @@ export const Time = {
},
};
export function unwrapAggregateError(error: any): any {
return error instanceof Error && Array.isArray((error as any).errors) && (error as any).errors.length
? unwrapAggregateError((error as any).errors[0])
: error;
}
export function errorMessage(err: Error | string) {
const t = typeof err === 'string' ? err : err.stack;
err = unwrapAggregateError(err);
const t = typeof err === 'string' ? err : err.stack || err.message || String(err);
const lines = t.split('\n')
.filter((i) => !i.includes(' (node:') && !i.includes('(internal'));
let cursor = 1;
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@hydrooj/utils",
"version": "1.5.7",
"version": "1.5.8",
"description": "hydrooj utils",
"type": "module",
"main": "lib/utils.ts",