Documentation
¶
Index ¶
Constants ¶
View Source
const ( ErrParseError = -32700 ErrInvalidRequest = -32600 ErrMethodNotFound = -32601 ErrInvalidParams = -32602 ErrInternalError = -32603 ErrForbidden = -32003 ErrNotFound = -32004 ErrTimeout = -32008 ErrConflict = -32009 ErrTooManyRequests = -32029 )
tRPC error codes (TRPC_ERROR_CODES_BY_KEY)
View Source
const ErrBadRequest = ErrInvalidRequest
ErrBadRequest is an alias for ErrInvalidRequest. Both map to tRPC code -32600. Use ErrBadRequest for application-level validation errors; ErrInvalidRequest for protocol-level errors.
Variables ¶
This section is empty.
Functions ¶
func HTTPStatus ¶
HTTPStatus returns the HTTP status code for a tRPC error code.
Types ¶
type TRPCError ¶
type TRPCError struct {
Code int `json:"code"`
Message string `json:"message"`
Cause error `json:"-"` // original error for logging; never sent to client
}
TRPCError represents a tRPC-compatible error.
func Wrap ¶
Wrap creates a TRPCError that wraps an underlying error. The cause is preserved for logging but never sent to the client.
Click to show internal directories.
Click to hide internal directories.