prpc.exceptions

exception prpc.exceptions.RpcError

Base library exception.

Note

Has the same properties as RpcRemoteError so that handling RPC exceptions using base class (i.e. ‘except RpcError’) is safer.

cause_type

Get nested exception type as a string.

cause_message

Get nested exception message as a string.

remote_traceback

Get full traceback as a single string.

exception prpc.exceptions.RpcLocalError

Represent local failures, e.g. unable to parse server response.

exception prpc.exceptions.RpcConnectionClosedError

Connection is unexpectedly closed.

exception prpc.exceptions.RpcConnectionTimeoutError

Connection is closed by timeout.

exception prpc.exceptions.RpcConnectionRejectedError

Connection is rejected at handshake stage.

exception prpc.exceptions.RpcCallTimeoutError

RPC execution timeout expired.

exception prpc.exceptions.RpcStreamTimeoutError

Stream read timeout expired (so data wasn’t consumed by method).

exception prpc.exceptions.RpcRemoteError(message, cause_type=None, cause_message=None, remote_traceback=None)

Base class for errors on peer’s side.

classmethod wrap_exception(message, exception)

Create remote error wrapping existing exception.

cause_type

Get nested exception type as a string.

cause_message

Get nested exception message as a string.

remote_traceback

Get full traceback as a single string.

exception prpc.exceptions.RpcMethodNotFoundError(message, cause_type=None, cause_message=None, remote_traceback=None)

Remote method is not found.

exception prpc.exceptions.RpcMethodError(message, cause_type=None, cause_message=None, remote_traceback=None)

Remote method raised an error.

exception prpc.exceptions.RpcServerError(message, cause_type=None, cause_message=None, remote_traceback=None)

Unspecified server error.

exception prpc.exceptions.RpcCancelledError(message, cause_type=’<cancelled by client>’, cause_message=’<cancelled by client>’, remote_traceback=None)

Call is cancelled.

exception prpc.exceptions.RpcUnknownError(message, cause_type=None, cause_message=None, remote_traceback=None)

Unexcepted failure occured on remote server.

exception prpc.exceptions.InvalidCallState

Call has invalid status for requested operation.

exception prpc.exceptions.InvalidStreamMode

Stream has invalid mode for requested operation.

exception prpc.exceptions.InvalidStreamState

Stream has invalid status for requested operation.

prpc.exceptions.format_traceback_string(exception)

Format exception traceback as a single string.

Parameters:exception – Exception object.
Returns:Full exception traceback as a string.
prpc.exceptions.finally_error(default_message, default_type=<class ‘prpc.exceptions.RpcLocalError’>)

Get a usable exception object in finally blocks.

If there is an active exception, return it, otherwise generate a new one.

Parameters:
  • default_message (str) – Exception message to use if there is no current exception
  • default_type (type) – Exception type to use if there is no current exception.
Returns:

Exception object.