Skip to content

Commit 99644d9

Browse files
author
Denis Gursky
committed
better error reporting
1 parent b7a4551 commit 99644d9

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

src/errors.ts

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -59,11 +59,12 @@ export function makeError(body: any, response: Response) {
5959
return new TransactionError(body, response);
6060
}
6161

62-
if (body?.message) {
63-
return new ApiError(body.message, body.status, body.details, response);
64-
}
65-
66-
return new Error(response.statusText);
62+
return new ApiError(
63+
body?.message || response.statusText || response.status,
64+
body?.status || response.status,
65+
body?.details,
66+
response,
67+
);
6768
}
6869

6970
export type SdkError = ApiError | TransactionError | Error;

0 commit comments

Comments
 (0)