mirror of
https://github.com/kellyjonbrazil/jc.git
synced 2025-07-17 01:32:37 +02:00
simplify OSError exception handling
This commit is contained in:
12
jc/cli.py
12
jc/cli.py
@ -470,18 +470,12 @@ def main():
|
|||||||
if magic_stderr:
|
if magic_stderr:
|
||||||
print(magic_stderr[:-1], file=sys.stderr)
|
print(magic_stderr[:-1], file=sys.stderr)
|
||||||
|
|
||||||
except FileNotFoundError:
|
except OSError as e:
|
||||||
if debug:
|
if debug:
|
||||||
raise
|
raise
|
||||||
|
|
||||||
utils.error_message([f'"{run_command_str}" command could not be found. For details use the -d or -dd option.'])
|
error_msg = os.strerror(e.errno)
|
||||||
sys.exit(combined_exit_code(magic_exit_code, JC_ERROR_EXIT))
|
utils.error_message([f'"{run_command_str}" command could not be run: {error_msg}. For details use the -d or -dd option.'])
|
||||||
|
|
||||||
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.'])
|
|
||||||
sys.exit(combined_exit_code(magic_exit_code, JC_ERROR_EXIT))
|
sys.exit(combined_exit_code(magic_exit_code, JC_ERROR_EXIT))
|
||||||
|
|
||||||
except Exception:
|
except Exception:
|
||||||
|
Reference in New Issue
Block a user