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

Minor Error Message Cleanup #3691

Merged
merged 5 commits into from
Feb 21, 2019
Merged

Minor Error Message Cleanup #3691

merged 5 commits into from
Feb 21, 2019

Conversation

alexanderbez
Copy link
Contributor

  • Targeted PR against correct branch (see CONTRIBUTING.md)

  • Linked to github-issue with discussion and accepted design OR link to spec that describes this work.

  • Wrote tests

  • Updated relevant documentation (docs/)

  • Added entries in PENDING.md with issue #

  • rereviewed Files changed in the github PR explorer


For Admin Use:

  • Added appropriate labels to PR (ex. wip, ready-for-review, docs)
  • Reviewers Assigned
  • Squashed all commits, uses message "Merge pull request #XYZ: [title]" (coding standards)

@alexanderbez alexanderbez added WIP Type: Code Hygiene General cleanup and restructuring of code to provide clarity, flexibility, and modularity. labels Feb 20, 2019
@alexanderbez alexanderbez requested review from alessio and jackzampolin and removed request for alessio and jackzampolin February 20, 2019 04:45
@codecov
Copy link

codecov bot commented Feb 20, 2019

Codecov Report

Merging #3691 into develop will decrease coverage by 0.01%.
The diff coverage is 53.33%.

@@            Coverage Diff             @@
##           develop   #3691      +/-   ##
==========================================
- Coverage    61.21%   61.2%   -0.02%     
==========================================
  Files          190     190              
  Lines        13995   13995              
==========================================
- Hits          8567    8565       -2     
- Misses        4892    4894       +2     
  Partials       536     536

@alexanderbez alexanderbez marked this pull request as ready for review February 20, 2019 05:23
@alexanderbez alexanderbez requested review from fedekunze, alessio and jackzampolin and removed request for ebuchman February 20, 2019 05:23
@alexanderbez alexanderbez added the T: API Breaking Breaking changes that impact APIs and the SDK only (not state machine). label Feb 20, 2019
Code int `json:"code,omitempty"`
Message string `json:"message"`
Code int `json:"code,omitempty"`
Error string `json:"error"`
Copy link
Contributor Author

@alexanderbez alexanderbez Feb 20, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ref: #3693 -- this should always be valid JSON @alessio. Thoughts?

/cc @faboweb

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes plz!

}
return acc.GetSequence(), nil
}

func (ak AccountKeeper) setSequence(ctx sdk.Context, addr sdk.AccAddress, newSequence uint64) sdk.Error {
acc := ak.GetAccount(ctx, addr)
if acc == nil {
return sdk.ErrUnknownAddress(addr.String())
return sdk.ErrUnknownAddress(fmt.Sprintf("account %s does not exist", addr))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should the ErrUnknownAddress take an addr and print out the error in the correct format?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure, but that would be break the general convention of these error functions where they all just take a simple msg string param.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah, not really crazy about that pattern. It seems to leave a lot of subtly different errors for the same issues. I think we should standardize these, but that may be out of the scope of the PR.

@@ -232,7 +234,7 @@ func queryDelegatorValidators(ctx sdk.Context, cdc *codec.Codec, req abci.Reques

errRes := cdc.UnmarshalJSON(req.Data, &params)
if errRes != nil {
return []byte{}, sdk.ErrUnknownAddress("")
return []byte{}, sdk.ErrInternal(fmt.Sprintf("failed to parse params: %s", err))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe sdk.ErrFailedParams or something similar?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmmm, I'm not sure that is totally a good idea as we could have a multitude of decoding failures and we don't want a unique failure type/function for reach. Maybe ErrFailedDecode but that can be for another PR.

Copy link
Member

@jackzampolin jackzampolin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A couple of small comments, but otherwise LGTM 👍

@jackzampolin
Copy link
Member

Just a pending fix then I will merge.

@alexanderbez
Copy link
Contributor Author

Fixed pending @jackzampolin

@rigelrozanski rigelrozanski merged commit 992dc8b into develop Feb 21, 2019
@rigelrozanski rigelrozanski deleted the bez/err-message-cleanup branch February 21, 2019 08:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
T: API Breaking Breaking changes that impact APIs and the SDK only (not state machine). Type: Code Hygiene General cleanup and restructuring of code to provide clarity, flexibility, and modularity.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants