Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
if not args:
args = [self.message]
self.request_id = kwargs.pop("request_id", None)
super(FixedErrorMessageMixin, self).__init__(*args, **kwargs)
def error_respond(self):
response = MSGPACKRPCErrorResponse()
response.error = self.message
response.unique_id = self.request_id
response._msgpackrpc_error_code = self.msgpackrpc_error_code
return response
class MSGPACKRPCParseError(FixedErrorMessageMixin, InvalidRequestError):
msgpackrpc_error_code = -32700
message = "Parse error"
class MSGPACKRPCInvalidRequestError(FixedErrorMessageMixin, InvalidRequestError):
msgpackrpc_error_code = -32600
message = "Invalid request"
class MSGPACKRPCMethodNotFoundError(FixedErrorMessageMixin, MethodNotFoundError):
msgpackrpc_error_code = -32601
message = "Method not found"
class MSGPACKRPCInvalidParamsError(FixedErrorMessageMixin, InvalidRequestError):
msgpackrpc_error_code = -32602
class MSGPACKRPCMethodNotFoundError(FixedErrorMessageMixin, MethodNotFoundError):
msgpackrpc_error_code = -32601
message = "Method not found"
class MSGPACKRPCInvalidParamsError(FixedErrorMessageMixin, InvalidRequestError):
msgpackrpc_error_code = -32602
message = "Invalid params"
class MSGPACKRPCInternalError(FixedErrorMessageMixin, InvalidRequestError):
msgpackrpc_error_code = -32603
message = "Internal error"
class MSGPACKRPCServerError(FixedErrorMessageMixin, InvalidRequestError):
msgpackrpc_error_code = -32000
message = ""
class MSGPACKRPCError(FixedErrorMessageMixin, 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.
:param error: This tuple contains the error specification: the numeric error
code and the error description.
"""
def __init__(
self, error: Union["MSGPACKRPCErrorResponse", Tuple[int, str]]
class MSGPACKRPCInvalidRequestError(FixedErrorMessageMixin, InvalidRequestError):
msgpackrpc_error_code = -32600
message = "Invalid request"
class MSGPACKRPCMethodNotFoundError(FixedErrorMessageMixin, MethodNotFoundError):
msgpackrpc_error_code = -32601
message = "Method not found"
class MSGPACKRPCInvalidParamsError(FixedErrorMessageMixin, InvalidRequestError):
msgpackrpc_error_code = -32602
message = "Invalid params"
class MSGPACKRPCInternalError(FixedErrorMessageMixin, InvalidRequestError):
msgpackrpc_error_code = -32603
message = "Internal error"
class MSGPACKRPCServerError(FixedErrorMessageMixin, InvalidRequestError):
msgpackrpc_error_code = -32000
message = ""
class MSGPACKRPCError(FixedErrorMessageMixin, 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.
:param error: This tuple contains the error specification: the numeric error
response.unique_id = self.request_id
response._msgpackrpc_error_code = self.msgpackrpc_error_code
return response
class MSGPACKRPCParseError(FixedErrorMessageMixin, InvalidRequestError):
msgpackrpc_error_code = -32700
message = "Parse error"
class MSGPACKRPCInvalidRequestError(FixedErrorMessageMixin, InvalidRequestError):
msgpackrpc_error_code = -32600
message = "Invalid request"
class MSGPACKRPCMethodNotFoundError(FixedErrorMessageMixin, MethodNotFoundError):
msgpackrpc_error_code = -32601
message = "Method not found"
class MSGPACKRPCInvalidParamsError(FixedErrorMessageMixin, InvalidRequestError):
msgpackrpc_error_code = -32602
message = "Invalid params"
class MSGPACKRPCInternalError(FixedErrorMessageMixin, InvalidRequestError):
msgpackrpc_error_code = -32603
message = "Internal error"
class MSGPACKRPCServerError(FixedErrorMessageMixin, InvalidRequestError):
msgpackrpc_error_code = -32000
class MSGPACKRPCParseError(FixedErrorMessageMixin, InvalidRequestError):
msgpackrpc_error_code = -32700
message = "Parse error"
class MSGPACKRPCInvalidRequestError(FixedErrorMessageMixin, InvalidRequestError):
msgpackrpc_error_code = -32600
message = "Invalid request"
class MSGPACKRPCMethodNotFoundError(FixedErrorMessageMixin, MethodNotFoundError):
msgpackrpc_error_code = -32601
message = "Method not found"
class MSGPACKRPCInvalidParamsError(FixedErrorMessageMixin, InvalidRequestError):
msgpackrpc_error_code = -32602
message = "Invalid params"
class MSGPACKRPCInternalError(FixedErrorMessageMixin, InvalidRequestError):
msgpackrpc_error_code = -32603
message = "Internal error"
class MSGPACKRPCServerError(FixedErrorMessageMixin, InvalidRequestError):
msgpackrpc_error_code = -32000
message = ""
class MSGPACKRPCError(FixedErrorMessageMixin, RPCError):
"""Reconstructs (to some extend) the server-side exception.
def error_respond(self):
response = MSGPACKRPCErrorResponse()
response.error = self.message
response.unique_id = self.request_id
response._msgpackrpc_error_code = self.msgpackrpc_error_code
return response
class MSGPACKRPCParseError(FixedErrorMessageMixin, InvalidRequestError):
msgpackrpc_error_code = -32700
message = "Parse error"
class MSGPACKRPCInvalidRequestError(FixedErrorMessageMixin, InvalidRequestError):
msgpackrpc_error_code = -32600
message = "Invalid request"
class MSGPACKRPCMethodNotFoundError(FixedErrorMessageMixin, MethodNotFoundError):
msgpackrpc_error_code = -32601
message = "Method not found"
class MSGPACKRPCInvalidParamsError(FixedErrorMessageMixin, InvalidRequestError):
msgpackrpc_error_code = -32602
message = "Invalid params"
class MSGPACKRPCInternalError(FixedErrorMessageMixin, InvalidRequestError):
msgpackrpc_error_code = -32603
def __init__(self, *args, **kwargs):
if not args:
args = [self.message]
self.request_id = kwargs.pop("request_id", None)
super(FixedErrorMessageMixin, self).__init__(*args, **kwargs)