Documentation ¶
Index ¶
- Constants
- type ErrorCode
- type ErrorMsg
- type RPCError
- func CastAsRPCError(err error) (*RPCError, bool)
- func NewInternal() *RPCError
- func NewInternalFromErr(err error) *RPCError
- func NewInvalidParams() *RPCError
- func NewInvalidParamsFromErr(err error) *RPCError
- func NewInvalidRequest() *RPCError
- func NewInvalidRequestFromErr(err error) *RPCError
- func NewMethodNotFound() *RPCError
- func NewMethodNotFoundFromErr(err error) *RPCError
- func NewNotFound() *RPCError
- func NewNotFoundFromErr(err error) *RPCError
- func NewParse() *RPCError
- func NewParseFromErr(err error) *RPCError
- func NewPreconditionFailed() *RPCError
- func NewPreconditionFailedFromErr(err error) *RPCError
- func NewUnauthorized() *RPCError
- func NewUnauthorizedFromErr(err error) *RPCError
Constants ¶
const ( ParseErrorCode ErrorCode = -32700 InvalidRequestErrorCode ErrorCode = -32600 MethodNotFoundErrorCode ErrorCode = -32601 InvalidParamsErrorCode ErrorCode = -32602 InternalErrorCode ErrorCode = -32603 NotFoundErrorCode ErrorCode = -32098 PreconditionFailedErrorCode ErrorCode = -32097 ParseErrorMsg ErrorMsg = "Parse error" InvalidRequestErrorMsg ErrorMsg = "Invalid request" MethodNotFoundErrorMsg ErrorMsg = "Method not found" InvalidParamsErrorMsg ErrorMsg = "Invalid params" InternalErrorMsg ErrorMsg = "Internal error" NotFoundErrorMsg ErrorMsg = "Not found" PreconditionFailedErrorMsg ErrorMsg = "Precondition failed" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type RPCError ¶
type RPCError struct { // Code indicates the error type that occurred. Code ErrorCode `json:"code"` // Message provides a short description of the error. Message ErrorMsg `json:"message"` // WrappedErr contains the original error (if any). WrappedErr error `json:"-"` }
RPCError as defined in: https://www.jsonrpc.org/specification
func CastAsRPCError ¶
CastAsRPCError casts the provided error as an RPC error type
func NewInternalFromErr ¶
NewInternalFromErr creates a new internal server RPCError wrapping the original error.
func NewInvalidParams ¶
func NewInvalidParams() *RPCError
NewInvalidParams creates a new invalid params RPCError.
func NewInvalidParamsFromErr ¶
NewInvalidParamsFromErr creates a new invalid params RPCError wrapping the original error.
func NewInvalidRequest ¶
func NewInvalidRequest() *RPCError
NewInvalidRequest creates a new invalid request RPCError.
func NewInvalidRequestFromErr ¶
NewInvalidRequestFromErr creates a new invalid request RPCError wrapping the original error.
func NewMethodNotFound ¶
func NewMethodNotFound() *RPCError
NewMethodNotFound creates a new method not found RPCError.
func NewMethodNotFoundFromErr ¶
NewMethodNotFoundFromErr creates a new method not found RPCError wrapping the original error.
func NewNotFound ¶
func NewNotFound() *RPCError
NewNotFound creates a new method not found RPCError.
func NewNotFoundFromErr ¶
NewNotFoundFromErr creates a new not found RPCError wrapping the original error.
func NewParseFromErr ¶
NewParseFromErr creates a new parse RPCError wrapping the original error.
func NewPreconditionFailed ¶
func NewPreconditionFailed() *RPCError
NewPreconditionFailed creates a new method not found RPCError.
func NewPreconditionFailedFromErr ¶
NewPreconditionFailedFromErr creates a new not found RPCError wrapping the original error.
func NewUnauthorized ¶
func NewUnauthorized() *RPCError
NewUnauthorized creates a new no authorized RPCError.
func NewUnauthorizedFromErr ¶
NewUnauthorizedFromErr creates a new no authorized RPCError wrapping the original error.
func (*RPCError) Marshal ¶
func (rpcError *RPCError) Marshal() *json.RawMessage
Marshal implements json.Marshaller.