Closed
Description
291-292
: Fix typo in docstring
There's a typo in "ShutdownComandRecived" - should be "ShutdownCommandReceived".
- The ShutdownComandRecived exception is used by the default handler
+ The ShutdownCommandReceived exception is used by the default handler
383-403
: Consider adding exit code range validation
While the mapping is comprehensive, consider adding validation to ensure exit codes are within the valid range (0-255).
+def validate_exit_code(code):
+ if not isinstance(code, int) or code < 0 or code > 255:
+ raise ValueError("Exit code must be an integer between 0 and 255")
+
EXIT_CODES = {
519-524
: Optimize exception type lookup
The current implementation performs two separate lookups. Consider combining them for better performance.
- if type(exc) in EXCEPTION_EXIT_CODES:
- return EXCEPTION_EXIT_CODES[type(exc)]
- for exc_class in EXCEPTION_EXIT_CODES:
- if isinstance(exc, exc_class):
- return EXCEPTION_EXIT_CODES[exc_class]
+ exc_type = type(exc)
+ if exc_type in EXCEPTION_EXIT_CODES:
+ return EXCEPTION_EXIT_CODES[exc_type]
+ return next((code for cls, code in EXCEPTION_EXIT_CODES.items()
+ if isinstance(exc, cls)), 70)
Metadata
Metadata
Assignees
Labels
Type
Projects
Status
Archive Backlog