Skip to content

Commit 1f2320b

Browse files
authored
Merge pull request #25 from nash-io/api-error-body
on API error, include the body
2 parents 3f40a60 + fef2607 commit 1f2320b

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
@@ -460,7 +460,8 @@ export class Client {
460460
if (resp.status !== 200) {
461461
let msg = `API error. Status code: ${resp.status}`
462462
if (resp.body) {
463-
msg += ` / body: ${resp.body.toString()}`
463+
const responseContent = await resp.text()
464+
msg += ` / body: ${responseContent}`
464465
}
465466
throw new Error(msg)
466467
}

0 commit comments

Comments
 (0)