Exception#

The momotor.rpc.exception module contains exception classes and a function to convert RPC messages with an exception field into a Python exception.

exception momotor.rpc.exception.AssetException(text, wire_message=None)#

Bases: RPCException

Indicates an error with an asset

type_code = 4#
type_name = 'asset'#
exception momotor.rpc.exception.AssetNotFoundException(text, wire_message=None)#

Bases: RPCException

Indicates the asset does not exist

type_code = 5#
type_name = 'asset_not_found'#
exception momotor.rpc.exception.AuthException(text, wire_message=None)#

Bases: RPCException

Indicates an authentication error

type_code = 2#
type_name = 'auth'#
exception momotor.rpc.exception.FormatException(text, wire_message=None)#

Bases: RPCException

Indicates an invalid (combination of) arguments

type_code = 1#
type_name = 'format'#
exception momotor.rpc.exception.JobException(text, wire_message=None)#

Bases: RPCException

Indicates an error with the job

type_code = 3#
type_name = 'job'#
exception momotor.rpc.exception.RPCException(text, wire_message=None)#

Bases: Exception

Base class for all protocol exceptions.

When a subclass of RPCException is raised by an RPC method, the exception is caught and converted into a Message containing the exception’s type_code and text

Should not be raised directly, but use one of the subclasses.

Parameters:
  • text – textual explanation of the exception

  • wire_message – the Exception message to include in the RPC response

type_code = 0#
type_name = 'rpc'#
property wire_message#
momotor.rpc.exception.raise_message_exception(message, *, log_level=10)#

If the message has an exception field, convert it into an RPCException and raise it

If message is None, raises UnexpectedEndOfStream.

If message has an exception field set, raises a subclass of RPCException

Produces logging information on the momotor.rpc.exception logger

Parameters:
  • message (Message | None) – The message to processes

  • log_level – level to log the exception message on