Documentation
¶
Index ¶
- func AbortWithError(c *gin.Context, err error)
- func Middleware(c *gin.Context)
- type Error
- func NewBadRequestError(err error, args ...string) *Error
- func NewConflictError(err error, args ...string) *Error
- func NewDatabaseError(err error, args ...string) *Error
- func NewForbiddenError(err error, args ...string) *Error
- func NewInternalServerError(err error, args ...string) *Error
- func NewNotFoundError(err error, args ...string) *Error
- func NewTooManyRequestsError(err error, args ...string) *Error
- func NewUnauthorizedError(err error, args ...string) *Error
- func NewValidationError(err error, args ...string) *Error
- type ErrorDetail
- type ErrorResponse
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AbortWithError ¶
AbortWithError adds the error to Gin's context and aborts the request
func Middleware ¶
Types ¶
type Error ¶
func NewBadRequestError ¶
func NewConflictError ¶
func NewDatabaseError ¶
func NewForbiddenError ¶
func NewInternalServerError ¶
func NewNotFoundError ¶
func NewTooManyRequestsError ¶
TODO (pipo) : could we use the stack, instead of the heap?
func NewUnauthorizedError ¶
func NewValidationError ¶
type ErrorDetail ¶
type ErrorDetail struct {
Code int `json:"code"`
Message string `json:"message"`
Details []string `json:"details,omitempty"`
}
TODO (pipo): do we really need this struct ? (1)
type ErrorResponse ¶
type ErrorResponse struct {
Error ErrorDetail `json:"error"`
}
TODO (pipo): do we really need this struct ? (2)
Click to show internal directories.
Click to hide internal directories.