-
Notifications
You must be signed in to change notification settings - Fork 23
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Missing error details on API error #32
Comments
The information exists inside the thrown error, just not printed. Maybe consider that it is printed to cater for ignorant devs (oops). Suggest this issue is closed. |
Displaying the details as it outputs the error is something I think would be useful as well. It's caught me off guard a few times where I have to manually go try queries or dig deeper into the error messages to find the actual root of the error. @jnordberg any immediate thoughts on how we could improve this? |
We should improve this function. It tries to pluck out the relevant into to the error message string but could be a lot better. |
I would like to work on this. Current thinking is to return @theblockstalk can you provide more examples to test against? |
Delving into the code, and now have a new/better understanding. I dove in and updated the method. It didn't work out too well as falsy values created verbose code, and forced isRejected tests on promises . @jnordberg Proposing a solution here, as always open to other ways of doing things.
Lots of alternatives. |
Regarding the scope of APIErrorData, I'm not sure we need to check every permutation. From looking at logs there are only a few data values we care about.
We can consider one additional case, to make the code more robust Simplifying what cases to support will collapse the number of if/else statements. In the case of number two above, APIError would never be created. Thats ok because errors can come from anywhere, there is no guarantee of APIError, and consumers of eosio.core always need to instanceof check the returned error. |
Still have this on my queue. Will submit new PR with hopefully, improved Json error parsing and simpler testing. |
I ran into this again today while working on the @wharfkit session library. When casting an error thrown by the Example: try {
// use APIClient for something
} catch (error: any) {
console.log(error.response.json) // the API response
} Improving this call like @jnordberg suggested is probably still the right path forward, but is not completed yet. I suspect that the inconsistencies in error responses from nodeos may cause that to be a rather lengthy undertaking to address from the client side. |
The error created from an error response from API calls is missing and not printing extra information in the
json.error.details
object that would be useful for developers to see. Only thejson.error.name
andjson.error.what
is printed.Error response from
v1.chainpush_transaction
:The text was updated successfully, but these errors were encountered: