heros.exceptions¶
Exceptions raised by HEROS, in particular those transported from a remote HERO.
Attributes¶
Exceptions¶
Base class of all HEROS errors. |
|
An exception that was raised inside a remote HERO while serving a request. |
|
The query to a remote HERO failed at transport level (interrupted stream, ...). |
Functions¶
|
Build (and cache) an exception class that is both a |
Module Contents¶
- heros.exceptions.ERROR_MARKER = '__heros_error__'¶
- exception heros.exceptions.RemoteHEROError(message: str, remote_type: str | None = None, remote_module: str | None = None, remote_traceback: str | None = None, endpoint: str | None = None)[source]¶
Bases:
HEROSErrorAn exception that was raised inside a remote HERO while serving a request.
- Parameters:
message – the
strof the remote exception.remote_type – class name of the remote exception, if the remote sent one.
remote_traceback – formatted traceback from the remote process.
endpoint – the endpoint that was queried.
- message¶
- remote_type = None¶
- remote_module = None¶
- remote_traceback = None¶
- endpoint = None¶
- classmethod from_payload(payload: Any, endpoint: str | None = None)[source]¶
Rebuild a remote exception from a serialized payload.
All payloads that do not have the correct format (dict with error marker) are wrapped in a bare
RemoteHEROErrorso that old HEROs keep working.
- exception heros.exceptions.RemoteTransportError[source]¶
Bases:
HEROSErrorThe query to a remote HERO failed at transport level (interrupted stream, …).
- heros.exceptions._mapping_blacklist¶
- heros.exceptions._error_class(remote_type: str | None) type[source]¶
Build (and cache) an exception class that is both a
RemoteHEROErrorand, where the remote exception is a builtin, that builtin.This lets user code keep writing
except ValueError:around a remote call while the HEROS-specific information stays available on the exception object.