Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Error ¶
type Error struct {
// Code is the HTTP-style status code (e.g., 400, 401, 500).
Code int `json:"code,omitempty"`
// Reason is a short error identifier (e.g., "InvalidParams", "Unauthorized").
Reason string `json:"reason,omitempty"`
// Message is a human-readable error description.
Message string `json:"message,omitempty"`
// Metadata holds additional key-value data about the error.
Metadata map[string]string `json:"metadata,omitempty"`
}
Error represents an error with HTTP-style code, reason, and message.
func FromError ¶
FromError converts an error to *Error. If the error is already an *Error, it returns it directly. Otherwise, it wraps it as an internal error.
func (*Error) JSONRPCCode ¶
JSONRPCCode returns the JSON-RPC error code for this error.
func (*Error) WithMessage ¶
WithMessage sets the error message.
Click to show internal directories.
Click to hide internal directories.