Skip to content

Commit 8f41e4f

Browse files
committed
Update the bytez js client so that it returns the error json from the server.
1 parent 90424e4 commit 8f41e4f

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

sdk/javascript/src/client.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,9 @@ export default class Client {
6262
!res.ok &&
6363
res.headers.get("content-type") !== "application/json"
6464
) {
65-
throw new Error(res.statusText);
65+
const { error } = await res.json().catch(console.error);
66+
67+
throw new Error(error || res.statusText);
6668
}
6769

6870
if (

0 commit comments

Comments
 (0)