-
-
Notifications
You must be signed in to change notification settings - Fork 318
[Question] Is it possible to get all validation errors in one exception ? #754
Copy link
Copy link
Closed
Description
I want to write a Python script that validate given configs file in my production server pre-deployment.
My implementation is working, but the raised ValidationError holds only the first encountered error.
What I want is to provide feedback in the console about all the keys that did not pass the validation.
I don't want to use the provided CLI because the script is doing a global check on the projet and I want config validation be a part of it.
My code looks like this :
# Validate config
try:
from config import config
# Trigger lazy loading
config._setup()
except ValidationError as e:
click.echo("Error occurred when validating settings files")
click.echo(str(e))
sys.exit(1)If this is not possible, can I propose an implementation with a PR ?
Reactions are currently unavailable