Documentation ¶
Index ¶
Constants ¶
View Source
const ( BadRequest = "HTTP Bad Request" // 400 Forbidden = "HTTP Forbidden" // 403 NotFound = "HTTP Not Found" // 404 ProxyAuthenticationRequired = "HTTP Proxy Authentication Required" // 407 Conflict = "HTTP Conflict" // 409 InternalServerError = "HTTP Internal Server Error" // 500 )
This package is designed to help influence the status code sent when an error is returned via an API. Just include one of the strings below in your error message text and the appropriate status code will get set if that error is ever serialized into an API response. InternalServerError takes precedence, and if an error doesn't include any of the strings at all then it is treated like an InternalServerError.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ErrorResponse ¶
type ErrorResponse struct { ToBlame string `json:"toBlame"` Type string `json:"type"` Message string `json:"message"` }
func ErrorToApiResponse ¶
func ErrorToApiResponse(err error) (int, ErrorResponse)
Click to show internal directories.
Click to hide internal directories.