Fix: Make response body readable in ApiError message.
This commit is contained in:
parent
b5eaf0b637
commit
5b0ec235cb
|
@ -53,7 +53,9 @@ export class ApiError extends Error {
|
||||||
: await response.text();
|
: await response.text();
|
||||||
|
|
||||||
return new ApiError(
|
return new ApiError(
|
||||||
`API ${method} request failed: ${path} => ${response.status} - ${body}`,
|
`API ${method} request failed: ${path} => ${
|
||||||
|
response.status
|
||||||
|
} - ${JSON.stringify(body)}`,
|
||||||
response.status,
|
response.status,
|
||||||
ApiErrorType.REQUEST_FAILED,
|
ApiErrorType.REQUEST_FAILED,
|
||||||
body
|
body
|
||||||
|
@ -67,7 +69,9 @@ export class ApiError extends Error {
|
||||||
json: JSONValue
|
json: JSONValue
|
||||||
): Promise<ApiError> {
|
): Promise<ApiError> {
|
||||||
return new ApiError(
|
return new ApiError(
|
||||||
`API ${method} request result has unexpected type. ${path} => ${json}`,
|
`API ${method} request result has unexpected type. ${path} => ${JSON.stringify(
|
||||||
|
json
|
||||||
|
)}`,
|
||||||
response.status,
|
response.status,
|
||||||
ApiErrorType.UNEXPECTED_RESULT_TYPE,
|
ApiErrorType.UNEXPECTED_RESULT_TYPE,
|
||||||
json
|
json
|
||||||
|
|
Loading…
Reference in a new issue