From 9d67c8cc6de324c76f838b790fadd5b707fc3423 Mon Sep 17 00:00:00 2001 From: bhalla Date: Sat, 21 Oct 2023 19:27:26 +0530 Subject: [PATCH] Better trapping of schema validation errors --- findSim.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/findSim.py b/findSim.py index 2f98159..0d92974 100644 --- a/findSim.py +++ b/findSim.py @@ -1395,7 +1395,11 @@ def loadJson( fname, mapFile ): with open( fs ) as _schema: schema = json.load( _schema ) - jsonschema.validate( findsim, schema ) + try: + jsonschema.validate( findsim, schema ) + except jsonschema.exceptions.ValidationError: + print( "Failed to validate findSim file {}".format( fname ) ) + raise expt = Experiment( findsim["Metadata"], findsim["Experiment"] ) stims = Stimulus.load( findsim ) # Stimuli are an optional argument readouts = Readout( findsim )