From 996152440bccca6a5b58ff100f1398a152f513ee Mon Sep 17 00:00:00 2001 From: Samuel Gaist <samuel.gaist@idiap.ch> Date: Fri, 12 Apr 2019 17:35:18 +0200 Subject: [PATCH] [schema] Print the JSON content on decoding error --- beat/core/schema/__init__.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/beat/core/schema/__init__.py b/beat/core/schema/__init__.py index ae809022..d182bf35 100644 --- a/beat/core/schema/__init__.py +++ b/beat/core/schema/__init__.py @@ -94,7 +94,11 @@ def load_schema(schema_name, version=1): with open(fname, "rb") as f: 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)) resolver = jsonschema.RefResolver("file://" + basedir + "/", schema) -- GitLab