You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently the calls to requests, such as postTransactionCommit(createTranfer), when error happens, the driver returns an error that just includes blanket 400 response, which is not useful.
In many cases, the server, even though it returns a status code of 400, it also returns a valid response body that will have much more meaningful information to the caller, which is not being supplied to the caller.
Instead of returning blanket 400 to the caller, return the original response also to the caller so that they can either log it or display it to the user.
Expected: the values sent to the promise catch handler should include detailed server response, and not just explanation of 400
conn.postTransactionCommit(createTranfer)
.then(res => {
//...
})
.catch(err => {
// Here the err should somehow include the original response from the server.
// Currently it just says 400 and explanation of 400, which is practically useless
})
The text was updated successfully, but these errors were encountered:
KrishnaPG
changed the title
For http requests requests, return the original response to the caller, not just 400
For http requests, return the original response to the caller, not just 400
Apr 27, 2018
function handleResponse(res) {
if (!(res && res.ok)) {
throw res; //<-- throw the response object as is. Callers know how to handle fetch errors
}
return res
}
or, else:
function handleResponse(res) {
if (!(res && res.ok)) {
const errorObject = {
message: 'HTTP Error: Requested page not reachable',
status: `${res.status} ${res.statusText}`,
requestURI: res.url,
response: res //<--- add the original error response here
}
throw errorObject
}
return res
}
This is really biting hard in the development, since we are almost blind as to why the server is not accepting the post transaction, and we have to manually check the post body externally every time there is a failure, which is very tedious.
Currently the calls to requests, such as
postTransactionCommit(createTranfer)
, when error happens, the driver returns an error that just includes blanket 400 response, which is not useful.In many cases, the server, even though it returns a status code of 400, it also returns a valid response body that will have much more meaningful information to the caller, which is not being supplied to the caller.
Instead of returning blanket 400 to the caller, return the original response also to the caller so that they can either log it or display it to the user.
Expected: the values sent to the promise catch handler should include detailed server response, and not just explanation of 400
The text was updated successfully, but these errors were encountered: