[diffoscope] 01/01: Print a nicer error message if you only specify one file by mistake.
Chris Lamb
chris at chris-lamb.co.uk
Thu Mar 1 22:52:10 CET 2018
This is an automated email from the git hooks/post-receive script.
lamby pushed a commit to branch master
in repository diffoscope.
commit 5541c765cb5352e3b8abe059cd0743595b259226
Author: Chris Lamb <lamby at debian.org>
Date: Thu Mar 1 21:50:22 2018 +0000
Print a nicer error message if you only specify one file by mistake.
---
diffoscope/main.py | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)
diff --git a/diffoscope/main.py b/diffoscope/main.py
index b24df03..9969e7a 100644
--- a/diffoscope/main.py
+++ b/diffoscope/main.py
@@ -22,6 +22,7 @@
import os
import sys
+import json
import signal
import logging
import argparse
@@ -380,7 +381,14 @@ def run_diffoscope(parsed_args):
if path1 is None or path1 == '-':
difference = load_diff(sys.stdin, "stdin")
else:
- difference = load_diff_from_path(path1)
+ try:
+ difference = load_diff_from_path(path1)
+ except json.JSONDecodeError:
+ traceback.print_exc()
+ print("E: Could not parse diff from '{}'. (Are you sure you"
+ "only meant to specify a single file?)".format(path1),
+ file=sys.stderr)
+ return 1
else:
if Config().exclude_directory_metadata is None:
if os.path.isdir(path1) and os.path.isdir(path2):
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/reproducible/diffoscope.git
More information about the diffoscope
mailing list