Skip to content

Commit

Permalink
Improve error message for invalid metadata
Browse files Browse the repository at this point in the history
Instead of reporting an incorrect exception about file not being a valid
JSON, print the actual reason.

Signed-off-by: Lubomír Sedlář <lsedlar@redhat.com>
  • Loading branch information
lubomir committed Sep 4, 2019
1 parent d9bedb6 commit 645b408
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions productmd/compose.py
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,6 @@ def _load_metadata(self, paths, cls):
obj = cls()
try:
obj.load(path)
except ValueError:
raise RuntimeError('%s is not a valid JSON file.' % path)
except ValueError as exc:
raise RuntimeError('%s can not be deserialized: %s.' % (path, exc))
return obj

0 comments on commit 645b408

Please sign in to comment.