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

Error when fetching balance for unknown account #650

Closed
nikita-fuchs opened this issue Sep 5, 2019 · 1 comment
Closed

Error when fetching balance for unknown account #650

nikita-fuchs opened this issue Sep 5, 2019 · 1 comment
Assignees
Labels
enhancement New feature or request
Milestone

Comments

@nikita-fuchs
Copy link
Contributor

nikita-fuchs commented Sep 5, 2019

Hey everyone, this has been annoying us all since forever and as the node is not going to change its behaviour about this, we should do in the SDK at least.

Currently, an error is thrown when getting the balance for an account not yet known to the chain. Tis is wrong for a syntactical reason and for the matters of good software engineering:

  • Getting a balance for an empty account is a perfectly fine thing to do and the answer needs to be 0 instead of an error
  • Errors should be only thrown if something goes bad / unexpected happens actually, which is not the case here.

I therefore suggest to return simply 0 and end this mess once and for all. Something cool like

{
balance: 0,
message: account not known to chain
}

would have been cool, but that would break with the current return format. Anyway, 99,99999% of all balance requests are the actually check the balance, not whether the account is known to the chain yet, so let's maybe have a separate method for that ?

@nduchak nduchak self-assigned this Sep 9, 2019
@nduchak nduchak added the enhancement New feature or request label Sep 9, 2019
@nduchak nduchak added this to the Sprint 48 milestone Sep 9, 2019
@nduchak
Copy link
Contributor

nduchak commented Sep 9, 2019

Resolved in #655

@nduchak nduchak closed this as completed Sep 10, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants