try {
return JSON.parse(new TextDecoder().decode(res.body))
} catch (err) {
- console.error('Cannot decode JSON.', res.body instanceof Buffer ? res.body.toString() : res.body)
+ console.error('Cannot decode JSON.', { res, body: res.body instanceof Buffer ? res.body.toString() : res.body })
throw err
}
}
try {
return JSON.parse(res.text)
} catch (err) {
- console.error('Cannot decode json', res.text)
+ console.error('Cannot decode json', { res, text: res.text })
throw err
}
}