GitHub

ProtocolError

API reference for ProtocolError.

An error with any other code (a resource not found, ...).

Attributes

AttributeTypeDescription
error_codeint = INTERNAL_ERROR_CODE
codeint

Functions

__init__

__init__(message, data=None, error_code=INTERNAL_ERROR_CODE) -> None
ParameterTypeDescription
messagestr
dataJsonValue = None
error_codeint = INTERNAL_ERROR_CODE

to_wire

to_wire() -> JsonRpcErrorObject

Returns JsonRpcErrorObject

def to_wire(self) -> JsonRpcErrorObject:
    error: JsonRpcErrorObject = {"code": self.code, "message": self.message}
    if self.data is not None:
        error["data"] = self.data
    return error