Skip to content

Commit b014e32

Browse files
committed
[__main__] wrap unified diff in try/except block
1 parent 65f8c74 commit b014e32

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

lib/fdiff/__main__.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,13 @@ def run(argv):
4949
)
5050
sys.exit(1)
5151

52-
diff = u_diff(args.PREFILE, args.POSTFILE, context_lines=args.lines)
52+
try:
53+
diff = u_diff(args.PREFILE, args.POSTFILE, context_lines=args.lines)
54+
except Exception as e:
55+
sys.stderr.write(
56+
f"[*] ERROR: During the attempt to diff the requested files the following error was encountered: {str(e)}"
57+
)
58+
sys.exit(1)
5359

5460
if args.color:
5561
for line in diff:

0 commit comments

Comments
 (0)