From 9bf491212a8887e940ce9f272e107830e47dfc9d Mon Sep 17 00:00:00 2001 From: "Kelvin M. Klann" Date: Tue, 18 Oct 2022 03:54:17 -0300 Subject: sort.py: print more standard error messages Where applicable, instead of creating custom ones. Example error messages: rm -f 123 && ./contrib/sort.py 123 [ Error ] [Errno 2] No such file or directory: '123' touch 123 && chmod -rwx 123 && ./contrib/sort.py 123 [ Error ] [Errno 13] Permission denied: '123' --- contrib/sort.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'contrib/sort.py') diff --git a/contrib/sort.py b/contrib/sort.py index 595ad0536..5cd4045f0 100755 --- a/contrib/sort.py +++ b/contrib/sort.py @@ -102,15 +102,15 @@ def main(args): exit_code = fix_profile(filename) else: fix_profile(filename) - except FileNotFoundError: - print(f"[ Error ] Can't find `{filename}'", file=stderr) + except FileNotFoundError as err: + print(f"[ Error ] {err}", file=stderr) exit_code = 1 - except PermissionError: - print(f"[ Error ] Can't read/write `{filename}'", file=stderr) + except PermissionError as err: + print(f"[ Error ] {err}", file=stderr) exit_code = 1 except Exception as err: print( - f"[ Error ] An error occurred while processing `{filename}': {err}", + f"[ Error ] An error occurred while processing '{filename}': {err}", file=stderr, ) exit_code = 1 -- cgit v1.2.3-70-g09d2