Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type ErrorResponse ¶
type ErrorResponse struct { Status int `json:"status"` Message string `json:"message"` Details interface{} `json:"details,omitempty"` }
ErrorResponse is the response that represents an error.
func BadRequest ¶
func BadRequest(msg string) ErrorResponse
BadRequest creates a new error response representing a bad request (HTTP 400)
func Forbidden ¶
func Forbidden(msg string) ErrorResponse
Forbidden creates a new error response representing an authorization failure (HTTP 403)
func InternalServerError ¶
func InternalServerError(msg string) ErrorResponse
InternalServerError creates a new error response representing an internal server error (HTTP 500)
func InvalidInput ¶
func InvalidInput(errs validation.Errors) ErrorResponse
InvalidInput creates a new error response representing a data validation error (HTTP 400).
func NotFound ¶
func NotFound(msg string) ErrorResponse
NotFound creates a new error response representing a resource-not-found error (HTTP 404)
func Unauthorized ¶
func Unauthorized(msg string) ErrorResponse
Unauthorized creates a new error response representing an authentication/authorization failure (HTTP 401)
func (ErrorResponse) Error ¶
func (e ErrorResponse) Error() string
Error is required by the error interface.
func (ErrorResponse) StatusCode ¶
func (e ErrorResponse) StatusCode() int
StatusCode is required by routing.HTTPError interface.