Skip to content
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

Wrong error result from REST endpoint #3601

Closed
4 tasks
faboweb opened this issue Feb 11, 2019 · 7 comments · Fixed by #3606
Closed
4 tasks

Wrong error result from REST endpoint #3601

faboweb opened this issue Feb 11, 2019 · 7 comments · Fixed by #3606
Assignees

Comments

@faboweb
Copy link
Contributor

faboweb commented Feb 11, 2019

Summary of Bug

POST /txs/broadcast returns a bad error response.

Actual (JSON with a string containing a stringified JSON):

{"message":"Msg 0 failed: {\"codespace\":\"sdk\",\"code\":10,\"message\":\"10stake \\u003c 99stake\"}"}

Expected (parsable JSON with human readable error message):

{"codespace":"sdk","code":10,"message":"You are trying to send more stake than you own. You own: 10stake. You tryed to send: 99stake"}"}

Steps to Reproduce


For Admin Use

  • Not duplicate issue
  • Appropriate labels applied
  • Appropriate contributors tagged
  • Contributor assigned/self-assigned
@alexanderbez
Copy link
Contributor

This seems like a duplicate of #2953.

@jackzampolin
Copy link
Member

Closing this as a duplicate.

@faboweb faboweb reopened this Feb 14, 2019
@faboweb
Copy link
Contributor Author

faboweb commented Feb 14, 2019

Reopening because of pending discussion about this.

@alexanderbez
Copy link
Contributor

alexanderbez commented Feb 14, 2019

@faboweb I do think we should close this issue and a corresponding issue should be opened in Tendermint as that serves a broader audience as it'll have larger implications. Then, another corresponding issue on the SDK can be opened which addresses the generic usage of Log as a map. This just focuses on errors. Again, I recommend we close. cc @jackzampolin

@jackzampolin
Copy link
Member

@faboweb Happy to talk about this in depth on our next call, but I've personally investigated fixing exactly what's bugging you twice and it is a tendermint issue.

@alexanderbez
Copy link
Contributor

alexanderbez commented Feb 19, 2019

Sorry for the mass miscommunication. From today's conversation, what we need to do is:

Since the log will always be valid JSON, thanks to #3606, we must intercept this value in sdk.Result which is a string and convert it to a map[string]interface{} before returning it.

@alexanderbez
Copy link
Contributor

#3688 doesn't actually solve this and I made another issue with a bit more in depth analysis here: #3693. I will close this and further work should be tracked on that issue. #3688 should still be merged though.

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

Successfully merging a pull request may close this issue.

3 participants