Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/checkpoint-restore/criu.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorAdrian Reber <areber@redhat.com>2021-03-15 16:57:38 +0300
committerAndrei Vagin <avagin@gmail.com>2021-09-03 20:31:00 +0300
commitbf9e502c6f24c5c723bf86205dfc6342b6bdf768 (patch)
treefb51d251658a8f1f85fa8e51d8621ebc3daf968a /lib
parentbf80fee4f4a7cb93fa804b3ed41f6ac29cd2bddc (diff)
lib: print nice error if crit gets wrong input
Signed-off-by: Adrian Reber <areber@redhat.com>
Diffstat (limited to 'lib')
-rwxr-xr-xlib/py/cli.py8
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))