Base Module
Platform-agnostic error handling framework / handlers.
- class cli_command_parser.error_handling.base.ErrorHandler[source]
Bases:
object
- exc_handler_map: dict[Type[BaseException], Handler]
- unregister(*exceptions: Type[BaseException])[source]
- __call__(*exceptions: Type[BaseException])[source]
- iter_handlers(exc_type: Type[BaseException], exc: BaseException) Iterator[Callable[[E], bool | int | None]] [source]
- copy() ErrorHandler [source]
- class cli_command_parser.error_handling.base.Handler(exc_cls: Type[BaseException], handler: Callable[[E], bool | int | None])[source]
Bases:
object
Wrapper around an exception class and the handler for it to facilitate sorting to select the most specific handler for a given exception.
- exc_cls
- handler
- cli_command_parser.error_handling.base.error_handler: ErrorHandler = <ErrorHandler[handlers=2]>
Default base
ErrorHandler
- cli_command_parser.error_handling.base.no_exit_handler: ErrorHandler = <ErrorHandler[handlers=2]>
An
ErrorHandler
that does not callsys.exit()
forCommandParserExceptions
- cli_command_parser.error_handling.base.extended_error_handler: ErrorHandler = <ErrorHandler[handlers=1]>
The default
ErrorHandler
(extendserror_handler
)