Cosmos-sdk: Machine readable error messages from the LCD

Created on 15 Aug 2018  Â·  6Comments  Â·  Source: cosmos/cosmos-sdk

Summary

Errors delivered from the LCD have a bunch of text wrapping the actual error message. We should deliver JSON error messages so clients can read the error and display it to the user.

Problem Definition

Proposal


For Admin Use

  • [ ] Not duplicate issue
  • [ ] Appropriate labels applied
  • [ ] Appropriate contributors tagged
  • [ ] Contributor assigned/self-assigned
UX proposal-accepted

Most helpful comment

Current:

  checkTx failed: (262245) Msg 0 failed: === ABCI Log ===
  Codespace: 4
  Code:      101
  ABCICode:  262245
  Error:     --= Error =--
  Data: common.FmtError{format:"validator for this address is currently revoked", args:[]interface {}(nil)}
  Msg Traces:
  --= /Error =--

  === /ABCI Log ===

Expected:

{
  "code": 1,
  "abci_code": 262245,
  "message": "checkTx failed: validator for this address is currently revoked"
}

All 6 comments

@faboweb can you attach an example of existing and desired output/error example?

Current:

  checkTx failed: (262245) Msg 0 failed: === ABCI Log ===
  Codespace: 4
  Code:      101
  ABCICode:  262245
  Error:     --= Error =--
  Data: common.FmtError{format:"validator for this address is currently revoked", args:[]interface {}(nil)}
  Msg Traces:
  --= /Error =--

  === /ABCI Log ===

Expected:

{
  "code": 1,
  "abci_code": 262245,
  "message": "checkTx failed: validator for this address is currently revoked"
}

@cosmos/cosmos-ui any other recommendations?

Thanks @faboweb !

I'm totally approve this. Parsing each distinct error msg completely avoidable

Implemented in types/errors.go #L247

Was this page helpful?
0 / 5 - 0 ratings

Related issues

rigelrozanski picture rigelrozanski  Â·  3Comments

rigelrozanski picture rigelrozanski  Â·  3Comments

rigelrozanski picture rigelrozanski  Â·  3Comments

johnmcdowall picture johnmcdowall  Â·  3Comments

fedekunze picture fedekunze  Â·  3Comments