Fix API Error handling
This commit is contained in:
parent
3a4548778c
commit
cf04fffdad
|
@ -55,11 +55,10 @@ class InternalAPIClient {
|
|||
response.status == 403
|
||||
) {
|
||||
console.error("Error in apiCall")
|
||||
console.error("Response:")
|
||||
console.error(response)
|
||||
console.error("Response:", response)
|
||||
const json = await response.json()
|
||||
console.error("Response body:")
|
||||
console.error(json)
|
||||
console.error("Response body:", json)
|
||||
console.error("Request body:", requestOptions.body)
|
||||
}
|
||||
return response
|
||||
}
|
||||
|
|
|
@ -44,12 +44,10 @@ class AccountsAPIClient {
|
|||
const response = await fetch(`${this.host}${url}`, requestOptions)
|
||||
if (response.status == 404 || response.status == 500) {
|
||||
console.error("Error in apiCall")
|
||||
console.error("Response:")
|
||||
console.error(response)
|
||||
console.error("Response body:")
|
||||
console.error(response.body)
|
||||
console.error("Request body:")
|
||||
console.error(requestOptions.body)
|
||||
console.error("Response:", response)
|
||||
const json = await response.json()
|
||||
console.error("Response body:", json)
|
||||
console.error("Request body:", requestOptions.body)
|
||||
}
|
||||
return response
|
||||
}
|
||||
|
|
|
@ -65,10 +65,10 @@ class PublicAPIClient {
|
|||
response.status == 403
|
||||
) {
|
||||
console.error("Error in apiCall")
|
||||
console.error("Response:")
|
||||
console.error(response)
|
||||
console.error("Response body:")
|
||||
console.error(response.body)
|
||||
console.error("Response:", response)
|
||||
const json = await response.json()
|
||||
console.error("Response body:", json)
|
||||
console.error("Request body:", requestOptions.body)
|
||||
}
|
||||
return response
|
||||
}
|
||||
|
|
|
@ -48,9 +48,10 @@ class AccountsAPIClient {
|
|||
response.status == 400
|
||||
) {
|
||||
console.error("Error in apiCall")
|
||||
console.error(response)
|
||||
console.error(response.body)
|
||||
console.error(requestOptions.body)
|
||||
console.error("Response:", response)
|
||||
const json = await response.json()
|
||||
console.error("Response body:", json)
|
||||
console.error("Request body:", requestOptions.body)
|
||||
}
|
||||
return response
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue