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

Make sure all errors are checked and handled #6

Closed
ThePiachu opened this issue Feb 29, 2016 · 1 comment
Closed

Make sure all errors are checked and handled #6

ThePiachu opened this issue Feb 29, 2016 · 1 comment
Assignees

Comments

@ThePiachu
Copy link

I noticed a few places in the code don't check errors they just generate. This for example caused me to lose half an hour debugging code since I accidentally passed an address instead of private key and the code forgot to assert the error wasn't nil. Some examples of this:

https://github.com/blockcypher/gobcy/blob/master/tx.go#L146
https://github.com/blockcypher/gobcy/blob/master/gobcy.go#L130

Similarly, here:

https://github.com/blockcypher/gobcy/blob/master/gobcy.go#L62

an error is not checked and it didn't catch the server backend API returned a message that wasn't compatible with JSON (sent a separate email about that).

@acityinohio acityinohio self-assigned this Feb 29, 2016
@acityinohio
Copy link
Contributor

Thanks as always for the error report @ThePiachu; ended up doing a rather large refactor of the way errors are handled. The upshot is that every call that has an error should be explicitly handled, and it will include the response body information (e.g. your TX Skeleton in the /txs/send) in addition to the proper errors.

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

No branches or pull requests

2 participants