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

Handle JSONDecodeErrors in validator #144

Merged
merged 1 commit into from Jan 22, 2020
Merged

Conversation

ml-evs
Copy link
Member

@ml-evs ml-evs commented Jan 22, 2020

Currently the validator doesn't provide any useful output (it crashes) when it encounters a malformed response that cannot be parsed as JSON. This PR catches that error and provides a more helpful error.

(see Materials-Consortia/providers#10 for context)

@ml-evs ml-evs requested a review from CasperWA January 22, 2020 19:41
@codecov
Copy link

codecov bot commented Jan 22, 2020

Codecov Report

Merging #144 into master will decrease coverage by 0.13%.
The diff coverage is 25%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #144      +/-   ##
==========================================
- Coverage   86.01%   85.87%   -0.14%     
==========================================
  Files          39       39              
  Lines        1830     1834       +4     
==========================================
+ Hits         1574     1575       +1     
- Misses        256      259       +3
Flag Coverage Δ
#unittests 85.87% <25%> (-0.14%) ⬇️
Impacted Files Coverage Δ
optimade/validator/validator.py 62.33% <25%> (-0.66%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update be7816b...df92b73. Read the comment docs.

@ml-evs
Copy link
Member Author

ml-evs commented Jan 22, 2020

We have our first eager deps failure!

Looks like lark v0.8 breaks all our tests, how fun.

@ml-evs ml-evs requested a review from ltalirz January 22, 2020 19:49
Copy link
Member

@ltalirz ltalirz left a comment

Choose a reason for hiding this comment

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

Makes sense to me.

Hopefully the fastapi server won't actually return too many invalid jsons ;-)

@ml-evs ml-evs merged commit aa14697 into master Jan 22, 2020
@ml-evs ml-evs deleted the ml-evs/validator_tweak branch January 22, 2020 21:28
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 this pull request may close these issues.

None yet

2 participants