Skip to content

Commit fb758ef

Browse files
committed
core: fix error output
1 parent 8d9a986 commit fb758ef

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

packages/core/src/core/pardon.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -499,7 +499,7 @@ export const PardonFetchExecution = pardonExecution({
499499
function why(error: unknown) {
500500
const reasons: string[] = [];
501501

502-
while (typeof error?.["cause"] === "object") {
502+
while (error?.["cause"] !== undefined) {
503503
reasons.unshift(String(error?.["message"] ?? error));
504504
error = error["cause"];
505505
}
@@ -510,7 +510,7 @@ function why(error: unknown) {
510510
return reasons.join("\n - ");
511511
}
512512

513-
return error;
513+
return error?.["message"] ?? error;
514514
}
515515

516516
function cleanRequestValues(request: Record<string, unknown>) {

0 commit comments

Comments
 (0)