Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
message = 'Invalid Request'
class JSONRPCMethodNotFoundError(FixedErrorMessageMixin, MethodNotFoundError):
"""The requested method name is not found in the registry."""
jsonrpc_error_code = -32601
message = 'Method not found'
class JSONRPCInvalidParamsError(FixedErrorMessageMixin, InvalidRequestError):
"""The provided parameters are not appropriate for the function called."""
jsonrpc_error_code = -32602
message = 'Invalid params'
class JSONRPCInternalError(FixedErrorMessageMixin, InvalidRequestError):
"""Unspecified error, not in the called function."""
jsonrpc_error_code = -32603
message = 'Internal error'
class JSONRPCServerError(FixedErrorMessageMixin, InvalidRequestError):
"""Unspecified error, this message originates from the called function."""
jsonrpc_error_code = -32000
message = ''
class JSONRPCError(FixedErrorMessageMixin, 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.
message = 'Method not found'
class JSONRPCInvalidParamsError(FixedErrorMessageMixin, InvalidRequestError):
"""The provided parameters are not appropriate for the function called."""
jsonrpc_error_code = -32602
message = 'Invalid params'
class JSONRPCInternalError(FixedErrorMessageMixin, InvalidRequestError):
"""Unspecified error, not in the called function."""
jsonrpc_error_code = -32603
message = 'Internal error'
class JSONRPCServerError(FixedErrorMessageMixin, InvalidRequestError):
"""Unspecified error, this message originates from the called function."""
jsonrpc_error_code = -32000
message = ''
class JSONRPCError(FixedErrorMessageMixin, 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.
:param dict error: 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
"""Converts the error to an error response object.
:return: An error response object ready to be serialized and sent to the client.
:rtype: :py:class:`JSONRPCErrorResponse`
"""
response = JSONRPCErrorResponse()
response.error = self.message
response.unique_id = self.request_id
response._jsonrpc_error_code = self.jsonrpc_error_code
if hasattr(self, 'data'):
response.data = self.data
return response
class JSONRPCParseError(FixedErrorMessageMixin, InvalidRequestError):
"""The request cannot be decoded or is malformed."""
jsonrpc_error_code = -32700
message = 'Parse error'
class JSONRPCInvalidRequestError(FixedErrorMessageMixin, InvalidRequestError):
"""The request contents are not valid for JSON RPC 2.0"""
jsonrpc_error_code = -32600
message = 'Invalid Request'
class JSONRPCMethodNotFoundError(FixedErrorMessageMixin, MethodNotFoundError):
"""The requested method name is not found in the registry."""
jsonrpc_error_code = -32601
message = 'Method not found'
return response
class JSONRPCParseError(FixedErrorMessageMixin, InvalidRequestError):
"""The request cannot be decoded or is malformed."""
jsonrpc_error_code = -32700
message = 'Parse error'
class JSONRPCInvalidRequestError(FixedErrorMessageMixin, InvalidRequestError):
"""The request contents are not valid for JSON RPC 2.0"""
jsonrpc_error_code = -32600
message = 'Invalid Request'
class JSONRPCMethodNotFoundError(FixedErrorMessageMixin, MethodNotFoundError):
"""The requested method name is not found in the registry."""
jsonrpc_error_code = -32601
message = 'Method not found'
class JSONRPCInvalidParamsError(FixedErrorMessageMixin, InvalidRequestError):
"""The provided parameters are not appropriate for the function called."""
jsonrpc_error_code = -32602
message = 'Invalid params'
class JSONRPCInternalError(FixedErrorMessageMixin, InvalidRequestError):
"""Unspecified error, not in the called function."""
jsonrpc_error_code = -32603
message = 'Internal error'
response.error = self.message
response.unique_id = self.request_id
response._jsonrpc_error_code = self.jsonrpc_error_code
if hasattr(self, 'data'):
response.data = self.data
return response
class JSONRPCParseError(FixedErrorMessageMixin, InvalidRequestError):
"""The request cannot be decoded or is malformed."""
jsonrpc_error_code = -32700
message = 'Parse error'
class JSONRPCInvalidRequestError(FixedErrorMessageMixin, InvalidRequestError):
"""The request contents are not valid for JSON RPC 2.0"""
jsonrpc_error_code = -32600
message = 'Invalid Request'
class JSONRPCMethodNotFoundError(FixedErrorMessageMixin, MethodNotFoundError):
"""The requested method name is not found in the registry."""
jsonrpc_error_code = -32601
message = 'Method not found'
class JSONRPCInvalidParamsError(FixedErrorMessageMixin, InvalidRequestError):
"""The provided parameters are not appropriate for the function called."""
jsonrpc_error_code = -32602
message = 'Invalid params'
def __init__(self, *args, **kwargs) -> None:
if not args:
args = [self.message]
self.request_id = kwargs.pop('request_id', None)
if 'data' in kwargs:
self.data = kwargs.pop('data')
super(FixedErrorMessageMixin, self).__init__(*args, **kwargs)
message = 'Parse error'
class JSONRPCInvalidRequestError(FixedErrorMessageMixin, InvalidRequestError):
"""The request contents are not valid for JSON RPC 2.0"""
jsonrpc_error_code = -32600
message = 'Invalid Request'
class JSONRPCMethodNotFoundError(FixedErrorMessageMixin, MethodNotFoundError):
"""The requested method name is not found in the registry."""
jsonrpc_error_code = -32601
message = 'Method not found'
class JSONRPCInvalidParamsError(FixedErrorMessageMixin, InvalidRequestError):
"""The provided parameters are not appropriate for the function called."""
jsonrpc_error_code = -32602
message = 'Invalid params'
class JSONRPCInternalError(FixedErrorMessageMixin, InvalidRequestError):
"""Unspecified error, not in the called function."""
jsonrpc_error_code = -32603
message = 'Internal error'
class JSONRPCServerError(FixedErrorMessageMixin, InvalidRequestError):
"""Unspecified error, this message originates from the called function."""
jsonrpc_error_code = -32000
message = ''