Documentation ¶
Index ¶
Constants ¶
View Source
const ( // ClientClosed is non-standard http status code, // which defined by nginx. // https://httpstatus.in/499/ HTTPStatusClientClosed = 499 )
Variables ¶
This section is empty.
Functions ¶
func FromGRPCCode ¶
func HandleBadRequest ¶
func HandleBadRequest(ctx *app.RequestContext, err error)
func HandleError ¶
func HandleError(ctx *app.RequestContext, err error)
Types ¶
type Error ¶
type Error struct { HTTPCode int `json:"code"` // The HTTP status code that corresponds to `google.rpc.Status.code`. Message string `json:"message"` // This corresponds to `google.rpc.Status.message`. GRPCStatus codes.Code `json:"status"` // This is the enum version for `google.rpc.Status.code`. Reason string `json:"reason"` Details []any `json:"details"` // This corresponds to `google.rpc.Status.details`. }
type ErrorOption ¶
type ErrorOption func(*Error)
func WithDetails ¶
func WithDetails(details ...any) ErrorOption
func WithMessage ¶
func WithMessage(message string) ErrorOption
type ErrorResponse ¶
type ErrorResponse struct { // The actual error payload. The nested message structure is for backward // compatibility with [Google API Client // Libraries](https://developers.google.com/api-client-library). It also // makes the error more readable to developers. Status Error `json:"error"` }
This message defines the error schema for Google's JSON HTTP APIs.
Click to show internal directories.
Click to hide internal directories.