1
0
mirror of https://github.com/kellyjonbrazil/jc.git synced 2025-07-15 01:24:29 +02:00

simplify OSError exception handling

This commit is contained in:
Kelly Brazil
2022-01-21 12:15:34 -08:00
parent 0a9279ae6b
commit ba86509c1d

View File

@ -470,18 +470,12 @@ def main():
if magic_stderr:
print(magic_stderr[:-1], file=sys.stderr)
except FileNotFoundError:
except OSError as e:
if debug:
raise
utils.error_message([f'"{run_command_str}" command could not be found. For details use the -d or -dd option.'])
sys.exit(combined_exit_code(magic_exit_code, JC_ERROR_EXIT))
except OSError:
if debug:
raise
utils.error_message([f'"{run_command_str}" command could not be run due to too many open files. For details use the -d or -dd option.'])
error_msg = os.strerror(e.errno)
utils.error_message([f'"{run_command_str}" command could not be run: {error_msg}. For details use the -d or -dd option.'])
sys.exit(combined_exit_code(magic_exit_code, JC_ERROR_EXIT))
except Exception: