We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent d883a6d commit bfb9823Copy full SHA for bfb9823
src/main.py
@@ -122,12 +122,19 @@ def main() -> None: # noqa: D103
122
# Parse arguments
123
try:
124
args = parser.parse_args()
125
+ except ExpectedException as e:
126
+ print(e.message, file=sys.stderr)
127
+ sys.exit(e.error_code)
128
except SystemExit as e:
129
if e.code != 0:
130
print(MESSAGE_ARG_GENERAL, file=sys.stderr)
131
sys.exit(EC_ARG_GENERAL)
132
# This happens when --help is used, exit gracefully
133
sys.exit(0)
134
+ except Exception as e:
135
+ print(traceback.format_exc(), file=sys.stderr)
136
+ print(f"Failed to run the program: {e}", file=sys.stderr)
137
+ sys.exit(1)
138
139
if hasattr(args, "func"):
140
# Check for updates only when help is not checked
0 commit comments