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