The Exceptions hierarchy¶
All exceptions are rooted in the Exception
class.
The RPCError
class derives from it and forms the basis of all tinyrpc exceptions.
Abstract exceptions¶
These exceptions, most of them will be overridden, define errors concerning the transport and structure of messages.
-
class
tinyrpc.exc.
RPCError
¶ -
Base class for all exceptions thrown by
tinyrpc
.-
error_respond
()¶ Converts the error to an error response object.
Returns: An error response instance or None
if the protocol decides to drop the error silently.Return type: RPCErrorResponse
-
-
class
tinyrpc.exc.
BadRequestError
Bases:
tinyrpc.exc.RPCError
,abc.ABC
Base class for all errors that caused the processing of a request to abort before a request object could be instantiated.
-
class
tinyrpc.exc.
BadReplyError
¶ Bases:
tinyrpc.exc.RPCError
,abc.ABC
Base class for all errors that caused processing of a reply to abort before it could be turned in a response object.
-
class
tinyrpc.exc.
InvalidRequestError
¶ Bases:
tinyrpc.exc.BadRequestError
,abc.ABC
A request made was malformed (i.e. violated the specification) and could not be parsed.
-
class
tinyrpc.exc.
InvalidReplyError
¶ Bases:
tinyrpc.exc.BadReplyError
,abc.ABC
A reply received was malformed (i.e. violated the specification) and could not be parsed into a response.
-
class
tinyrpc.exc.
MethodNotFoundError
¶ Bases:
tinyrpc.exc.RPCError
,abc.ABC
The desired method was not found.
-
class
tinyrpc.exc.
InvalidParamsError
¶ Bases:
tinyrpc.exc.RPCError
,abc.ABC
The provided parameters do not match those of the desired method.
-
class
tinyrpc.exc.
ServerError
¶ Bases:
tinyrpc.exc.RPCError
,abc.ABC
An internal error in the RPC system occurred.
Protocol exceptions¶
Each protocol provides its own concrete implementations of these exceptions.
JSON-RPC¶
-
class
tinyrpc.protocols.jsonrpc.
JSONRPCParseError
(*args, **kwargs) Bases:
tinyrpc.protocols.jsonrpc.FixedErrorMessageMixin
,tinyrpc.exc.InvalidRequestError
The request cannot be decoded or is malformed.
-
class
tinyrpc.protocols.jsonrpc.
JSONRPCInvalidRequestError
(*args, **kwargs) Bases:
tinyrpc.protocols.jsonrpc.FixedErrorMessageMixin
,tinyrpc.exc.InvalidRequestError
The request contents are not valid for JSON RPC 2.0
-
class
tinyrpc.protocols.jsonrpc.
JSONRPCMethodNotFoundError
(*args, **kwargs) Bases:
tinyrpc.protocols.jsonrpc.FixedErrorMessageMixin
,tinyrpc.exc.MethodNotFoundError
The requested method name is not found in the registry.
-
class
tinyrpc.protocols.jsonrpc.
JSONRPCInvalidParamsError
(*args, **kwargs) Bases:
tinyrpc.protocols.jsonrpc.FixedErrorMessageMixin
,tinyrpc.exc.InvalidRequestError
The provided parameters are not appropriate for the function called.
-
class
tinyrpc.protocols.jsonrpc.
JSONRPCInternalError
(*args, **kwargs) Bases:
tinyrpc.protocols.jsonrpc.FixedErrorMessageMixin
,tinyrpc.exc.InvalidRequestError
Unspecified error, not in the called function.
-
class
tinyrpc.protocols.jsonrpc.
JSONRPCServerError
(*args, **kwargs) Bases:
tinyrpc.protocols.jsonrpc.FixedErrorMessageMixin
,tinyrpc.exc.InvalidRequestError
Unspecified error, this message originates from the called function.
This last exception is a client side exception designed to represent the server side error in the client.
-
class
tinyrpc.protocols.jsonrpc.
JSONRPCError
(error: Union[JSONRPCErrorResponse, Dict[str, Any]]) Bases:
tinyrpc.protocols.jsonrpc.FixedErrorMessageMixin
,tinyrpc.exc.RPCError
Reconstructs (to some extend) the server-side exception.
The client creates this exception by providing it with the
error
attribute of the JSON error response object returned by the server.Parameters: error (dict) – This dict contains the error specification:
- code (int): the numeric error code.
- message (str): the error description.
- data (any): if present, the data attribute of the error
MSGPACK-RPC¶
-
class
tinyrpc.protocols.msgpackrpc.
MSGPACKRPCParseError
(*args, **kwargs) Bases:
tinyrpc.protocols.msgpackrpc.FixedErrorMessageMixin
,tinyrpc.exc.InvalidRequestError
-
class
tinyrpc.protocols.msgpackrpc.
MSGPACKRPCInvalidRequestError
(*args, **kwargs) Bases:
tinyrpc.protocols.msgpackrpc.FixedErrorMessageMixin
,tinyrpc.exc.InvalidRequestError
-
class
tinyrpc.protocols.msgpackrpc.
MSGPACKRPCMethodNotFoundError
(*args, **kwargs) Bases:
tinyrpc.protocols.msgpackrpc.FixedErrorMessageMixin
,tinyrpc.exc.MethodNotFoundError
-
class
tinyrpc.protocols.msgpackrpc.
MSGPACKRPCInvalidParamsError
(*args, **kwargs) Bases:
tinyrpc.protocols.msgpackrpc.FixedErrorMessageMixin
,tinyrpc.exc.InvalidRequestError
-
class
tinyrpc.protocols.msgpackrpc.
MSGPACKRPCInternalError
(*args, **kwargs) Bases:
tinyrpc.protocols.msgpackrpc.FixedErrorMessageMixin
,tinyrpc.exc.InvalidRequestError
-
class
tinyrpc.protocols.msgpackrpc.
MSGPACKRPCServerError
(*args, **kwargs) Bases:
tinyrpc.protocols.msgpackrpc.FixedErrorMessageMixin
,tinyrpc.exc.InvalidRequestError
This last exception is a client side exception designed to represent the server side error in the client.
-
class
tinyrpc.protocols.msgpackrpc.
MSGPACKRPCError
(error: Union[MSGPACKRPCErrorResponse, Tuple[int, str]]) Bases:
tinyrpc.protocols.msgpackrpc.FixedErrorMessageMixin
,tinyrpc.exc.RPCError
Reconstructs (to some extend) the server-side exception.
The client creates this exception by providing it with the
error
attribute of the MSGPACK error response object returned by the server.Parameters: error – This tuple contains the error specification: the numeric error code and the error description.