Core Features
errortools provides a comprehensive set of utilities for exception handling, organized into several categories:
Exception Handling
Tools for catching and suppressing exceptions gracefully:
ignore()- Context manager/decorator with full metadata trackingfast_ignore()- Lightweight suppression without metadataignore_subclass()- Suppress any subclass of a base exceptionignore_warns()- Suppress warnings
See Exception Handling for details.
Raising Exceptions
Utilities for raising and converting exceptions:
raises()- Raise exceptions from listsraises_all()- Batch raise multiple exceptions as ExceptionGroupreraise()- Convert exception types on the flyassert_raises()- Assert a callable raises specific exceptions
See Raising Exceptions for details.
Decorators
Function decorators for common patterns:
@retry()- Automatic retry on failure@timeout()- Async function timeout@error_cache()- Cache exceptions by arguments@deprecated()- Mark functions as deprecated@experimental()- Mark functions as experimental
See Decorators for details.
Custom Exceptions
Structured exception classes with error codes and context:
PureBaseException- Base class with error codesContextException- Adds trace IDs and context dictBaseErrorCodes- Predefined error code factory
See Custom Exceptions for details.
Warnings
Structured warning classes with factory methods:
BaseWarning- Base warning classDeprecatedWarning- Deprecation warningsPerformanceWarning- Performance warningsResourceUsageWarning- Resource usage warnings
See Warnings for details.