Base error for any backend errors.
Examples:
Handling inner error:
>>> try:
>>> client.method()
>>> except BackendError as e:
>>> match e.inner:
>>> case httpx.TimeoutException():
>>> # Handle timeout error.
>>> case _:
>>> raise
Wrapping client call (only needed for a new backend implementation):
>>> with BackendError:
>>> ...
Source code in combadge/core/errors.py
| class BackendError(CombadgeError, metaclass=_BackendErrorMeta):
"""
Base error for any backend errors.
Examples:
Handling inner error:
>>> try:
>>> client.method()
>>> except BackendError as e:
>>> match e.inner:
>>> case httpx.TimeoutException():
>>> # Handle timeout error.
>>> case _:
>>> raise
Wrapping client call (only needed for a new backend implementation):
>>> with BackendError:
>>> ...
"""
def __init__(self, inner: BaseException) -> None:
"""
Instantiate the backend error.
Args:
inner: wrapped backend client exception
"""
super().__init__(inner)
@property
def inner(self) -> BaseException:
"""Get the wrapped backend client exception."""
return self.args[0]
|
inner
property
Get the wrapped backend client exception.
__init__
__init__(inner: BaseException) -> None
Instantiate the backend error.
Parameters:
Name |
Type |
Description |
Default |
inner |
BaseException
|
wrapped backend client exception
|
required
|
Source code in combadge/core/errors.py
| def __init__(self, inner: BaseException) -> None:
"""
Instantiate the backend error.
Args:
inner: wrapped backend client exception
"""
super().__init__(inner)
|