Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Standarize REST errors response msgs #2445

Closed
4 tasks
fedekunze opened this issue Oct 5, 2018 · 2 comments
Closed
4 tasks

Standarize REST errors response msgs #2445

fedekunze opened this issue Oct 5, 2018 · 2 comments

Comments

@fedekunze
Copy link
Collaborator

fedekunze commented Oct 5, 2018

Summary

Create a standard value for error messages in REST responses

Problem Definition

Even thought the new object format makes it easier to get each of the components of an error (eg: codespace, code, abci_code, and message) Currently clients have to parse the content of the message value to get the desired format. For example:

{"codespace":1,"code":12,"abci_code":65548,"message":"checkTx failed: Error{out of gas in location: WritePerByte}"}

This is caused by a series of added messages to the error, such as fmt.Sprintf("checkTx failed: %s", err.Error())

Ref to voyager issue for parsing Errors: luniehq/lunie#1131
Ref to user feedback issue about the same problem: #1892

Proposal

  • refactor to use utils.WriteErrorResponse(w http.ResponseWriter, status int, msg string) as the desired format for errors
  • additional msgs should go inside the error msg: eg: "message":"Error{checkTx failed; out of gas in location: WritePerByte}"

For Admin Use

  • Not duplicate issue
  • Appropriate labels applied
  • Appropriate contributors tagged
  • Contributor assigned/self-assigned
@fedekunze fedekunze added S:blocked Status: Blocked lite labels Oct 5, 2018
@fedekunze fedekunze added prelaunch-2.0 and removed S:blocked Status: Blocked labels Oct 5, 2018
@jackzampolin
Copy link
Member

This is a great proposal! Lets adopt!

@fedekunze
Copy link
Collaborator Author

here's another example of the message value:

deliverTx failed: (262246) Msg 0 failed: Error{no unbonding delegation found}

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants