Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrNS = errorx.NewNamespace("error.api") ErrAuth = ErrNS.NewType("auth") ErrOther = ErrNS.NewType("other") ErrInvalidRequest = ErrNS.NewType("invalid_request") ErrInternalServer = ErrNS.NewType("internal_server_error") ErrNotFound = ErrNS.NewType("resource_not_found") )
Functions ¶
func ExecWithDeadline ¶ added in v1.0.2
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.
Types ¶
Click to show internal directories.
Click to hide internal directories.