Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrNS = errorx.NewNamespace("error.api") ErrUnknown = ErrNS.NewType("unknown") ErrInvalidRequest = ErrNS.NewType("invalid_request") ErrInternalServer = ErrNS.NewType("internal_server_error") ErrNotFound = ErrNS.NewType("resource_not_found") ErrNoClusterPrivilege = ErrNS.NewType("no_cluster_privilege") ErrNoNamespacePrivilege = ErrNS.NewType("no_namespace_privilege") )
Functions ¶
func AuthRequired ¶ added in v1.1.0
func MWHandleErrors ¶
func MWHandleErrors() gin.HandlerFunc
MWHandleErrors creates a middleware that turns (last) error in the context into an APIError json response. In handlers, `c.Error(err)` can be used to attach the error to the context. When error is attached in the context: - The handler can optionally assign the HTTP status code. - The handler must not self-generate a response body.
func SetErrorForGinCtx ¶ added in v1.1.0
Types ¶
Click to show internal directories.
Click to hide internal directories.