nicetoolbox.utils.error_handling¶
Functions
Context manager that handles errors based on hierarchical error levels. |
- nicetoolbox.utils.error_handling.manage_error_scope(current_level: ErrorLevel, threshold_level: ErrorLevel, context_name: str)[source]¶
Context manager that handles errors based on hierarchical error levels.
If the current_level is greater than or equal to the threshold_level, it suppresses exceptions, logs the error, and allows the outer loop to continue.
If the current_level is less than the threshold_level, it re-raises the exception for the outer loop.
- Parameters:
current_level (ErrorLevel) – The current error tolerance level (selected by the user in the config).
threshold_level (ErrorLevel) – The threshold level to compare against.
context_name (str) – Name of the current context for logging.
- Raises:
Exception – Re-raises the caught exception if the current_level is less than the threshold_level