Skip to content

JSON loader does not give an descriptive error #209

@bvanelli

Description

@bvanelli

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions