Convenience signal handler for exitable errors #32

Open
opened 2023-12-28 11:50:04 +01:00 by ni · 2 comments
ni commented 2023-12-28 11:50:04 +01:00 (Migrated from git.w21.org)

This pattern is so typical it deserves a convenience decorator:

try:
    <some code>
except Exception as e:
    sys.exit(f"{ovc._program}: {e}")

Maybe we wouldn't even have to pass the program name along, we can grab it out of sys...

This pattern is so typical it deserves a convenience decorator: try: <some code> except Exception as e: sys.exit(f"{ovc._program}: {e}") Maybe we wouldn't even have to pass the program name along, we *can* grab it out of `sys`...
ni commented 2023-12-28 11:50:29 +01:00 (Migrated from git.w21.org)

changed the description

changed the description
ni commented 2025-09-24 11:00:19 +02:00 (Migrated from git.w21.org)

Decorator, or perhaps rather a context manager?

Decorator, or perhaps rather a context manager?
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
w21/jpylib#32
No description provided.