Skip to content

Commit fef2607

Browse files
committed
on API error, include the body
1 parent eadecdd commit fef2607

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/client/client.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -445,7 +445,8 @@ export class Client {
445445
if (resp.status !== 200) {
446446
let msg = `API error. Status code: ${resp.status}`
447447
if (resp.body) {
448-
msg += ` / body: ${resp.body.toString()}`
448+
const responseContent = await resp.text()
449+
msg += ` / body: ${responseContent}`
449450
}
450451
throw new Error(msg)
451452
}

0 commit comments

Comments
 (0)