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

JSON loader does not give an descriptive error #209

Closed
bvanelli opened this issue Mar 19, 2021 · 0 comments
Closed

JSON loader does not give an descriptive error #209

bvanelli opened this issue Mar 19, 2021 · 0 comments

Comments

@bvanelli
Copy link
Contributor

The JSON loader does not handle JSON exceptions when loading, how to reproduce the error (tested on environs 9.3.1, latest on pipy at the moment):

from environs import Env
import os

os.environ['TEST_JSON'] = 'test'

env = Env()

env.json('TEST_JSON')

Error message:

json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

Whereas I would expect a more descriptive error like in the other parsers:

environs.EnvValidationError: Environment variable "TEST_JSON" invalid: Not a valid boolean.
sloria added a commit that referenced this issue Mar 28, 2021
* Fix json parser not being descriptive enough (#209).

* Fix tox warnings.

* Minor fixups; update changelog

Co-authored-by: Steven Loria <[email protected]>
@sloria sloria closed this as completed Mar 28, 2021
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