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

Don't ignore JSON decoding errors #193

Closed
jasonpaulos opened this issue May 18, 2021 · 2 comments · Fixed by #205
Closed

Don't ignore JSON decoding errors #193

jasonpaulos opened this issue May 18, 2021 · 2 comments · Fixed by #205

Comments

@jasonpaulos
Copy link
Contributor

Summary

Currently if a JSON algod request cannot parse the response, it just returns None:

try:
return json.load(resp)
except json.JSONDecodeError:
return None

Scope

We should really return an error message in this case instead.

Urgency

It's important to display the proper error if decoding is unsuccessful.

@jkschin
Copy link
Contributor

jkschin commented Jun 21, 2021

Hey @jasonpaulos, are you taking PRs for this? I've got two ideas:

  1. Instead of returning None, we raise json.JSONDecodeError.
  2. Inside error.py, create a class named AlgodJSONDecodeError and customize the messages.

Is there a place I should be writing a test for this as well? I can't find it. Happy to contribute a short PR and get familiar with Algorand.

@jasonpaulos
Copy link
Contributor Author

@jkschin we would definitely appreciate a PR for this! Currently there is no easy way to automate a test for this (unless we can mock algod 🤔), so in this case I'd be inclined to accept a PR without a test.

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.

2 participants