Skip to content
Snippets Groups Projects
Commit 99615244 authored by Samuel GAIST's avatar Samuel GAIST
Browse files

[schema] Print the JSON content on decoding error

parent 459b3393
No related branches found
No related tags found
1 merge request!67Protocol template
...@@ -94,7 +94,11 @@ def load_schema(schema_name, version=1): ...@@ -94,7 +94,11 @@ def load_schema(schema_name, version=1):
with open(fname, "rb") as f: with open(fname, "rb") as f:
data = f.read().decode() data = f.read().decode()
schema = json.loads(data) try:
schema = json.loads(data)
except json.errors.JSONDecodeError:
print("Invalid json:\n {data}".format(data))
raise
basedir = os.path.realpath(os.path.dirname(fname)) basedir = os.path.realpath(os.path.dirname(fname))
resolver = jsonschema.RefResolver("file://" + basedir + "/", schema) resolver = jsonschema.RefResolver("file://" + basedir + "/", schema)
......
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