diff options
author | Adrian Reber <areber@redhat.com> | 2021-03-15 16:57:38 +0300 |
---|---|---|
committer | Andrei Vagin <avagin@gmail.com> | 2021-09-03 20:31:00 +0300 |
commit | bf9e502c6f24c5c723bf86205dfc6342b6bdf768 (patch) | |
tree | fb51d251658a8f1f85fa8e51d8621ebc3daf968a /lib | |
parent | bf80fee4f4a7cb93fa804b3ed41f6ac29cd2bddc (diff) |
lib: print nice error if crit gets wrong input
Signed-off-by: Adrian Reber <areber@redhat.com>
Diffstat (limited to 'lib')
-rwxr-xr-x | lib/py/cli.py | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/lib/py/cli.py b/lib/py/cli.py index 1d8b8515f..cb125aab8 100755 --- a/lib/py/cli.py +++ b/lib/py/cli.py @@ -60,7 +60,13 @@ def decode(opts): def encode(opts): - img = json.load(inf(opts)) + try: + img = json.load(inf(opts)) + except UnicodeDecodeError: + print("Cannot read JSON.\n"\ + "Maybe you are feeding me an image with protobuf data? "\ + "Encode expects JSON input.", file=sys.stderr) + sys.exit(1) pycriu.images.dump(img, outf(opts, False)) |