handle_connection_error¶
- pyrcs.utils.handle_connection_error(update=False, verbose=False, e=None, raise_error=False)[source]¶
Handle connection errors occurring during data processing or update lifecycles.
This utility processes network connection failures by issuing localised feedback notifications based on system configurations, while facilitating optional error escalation controls.
- Parameters:
update (bool) – Indicates whether the error occurred during a package update phase. Defaults to
False.verbose (bool | int) – Whether to print descriptive details to the console output. Defaults to
False.e (Exception | None) – An optional exception instance to evaluate or raise.
raise_error (bool) – Whether to propagate the exception out of scope; defaults to
False.
- Returns:
None if execution proceeds or errors are suppressed.
- Return type:
None
- Raises:
ConnectionError – If
raise_error=Trueand no explicit contexteis provided.Exception – Propagates the native exception
eif execution triggersraise_error.
Examples:
>>> from pyrcs.utils import handle_connection_error >>> handle_connection_error(verbose=True) The Internet connection is not available. >>> handle_connection_error(update=True, verbose=True) The Internet connection is not available. Failed to update the data. >>> handle_connection_error(update=True, verbose=2, raise_error=True) Failed. The Internet connection is not available. Failed to update the data. Traceback (most recent call last): ... ConnectionError: The Internet connection is not available. Failed to update the data.