-
Notifications
You must be signed in to change notification settings - Fork 3.7k
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
Standardize API Responses/HTTP Codes #4923
Comments
How about the case of 1)? If it's a client side issue we should send invalid request then right? |
@tnachen in the case of (1) this means proof verification failed; i.e. the proof Tendermint sent us in the ABCI query response is invalid. Not sure what else we can do apart from what we currently do. |
Should we just send a bad request back? |
hmmm, maybe we should return 4xx for proof verification failure. Good idea. |
We should probably tackle #4844 first and then this issue. |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
grpc error codes brings this to us, we just need to do a little grooming of what error is needed for each response |
Summary
Currently when querying for a resource(s) from a querier, in the non-happy path we naively return a 500 HTTP status code with the error:
This can happen for any of the following reasons:
2a. Bad querier path
2b. Invalid query height
2c. Invalid query height with proof
2d. Querying against pruned state
2e. The resource(s) does not exist
Problem Definition
We should not be returning a 500 naively for all these conditions.
result
and either the current or provided height.Proposal
Based on the error, use a proper
code
in theResponseQuery
object to effectively return the correct type of error. Then, theCLIContext
(or whatever upstream client) can appropriately handle this by returning a typed error. Finally, the desired HTTP status code and body can be returned based on the concrete type of the error.e.g.
Note: I'm not sure if this will be a trivial or small PR but can be broken down into multiple PRs. Essentially each REST handler (CLI too?) and module querier method will have to be adjusted.
/cc @jackzampolin @fedekunze
For Admin Use
The text was updated successfully, but these errors were encountered: