Skip to content
Snippets Groups Projects
Commit a22a4800 authored by Jorrit Schaap's avatar Jorrit Schaap
Browse files

TMSS-272: fixed exception type

parent 6c8234e5
No related branches found
No related tags found
1 merge request!213Resolve TMSS-272
......@@ -178,18 +178,18 @@ def validate_json_against_schema(json_string: str, schema: str):
try:
json_object = json.loads(json_string)
except json.decoder.JSONDecodeError as e:
raise jsonschema.SchemaValidationException("Invalid JSON: %s\n%s" % (str(e), json_string))
raise jsonschema.exceptions.ValidationError("Invalid JSON: %s\n%s" % (str(e), json_string))
try:
schema_object = json.loads(schema)
except json.decoder.JSONDecodeError as e:
raise jsonschema.SchemaValidationException("Invalid JSON: %s\n%s" % (str(e), schema))
raise jsonschema.exceptions.ValidationError("Invalid JSON: %s\n%s" % (str(e), schema))
# now do the actual validation
try:
validate_json_object_with_schema(json_object, schema_object)
except jsonschema.ValidationError as e:
raise jsonschema.SchemaValidationException(str(e))
raise jsonschema.exceptions.ValidationError(str(e))
def get_default_json_object_for_schema(schema: str) -> dict:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment