Documentation
¶
Index ¶
- func WriteError(w http.ResponseWriter, err error, defaultStatusCode int)
- func WriteJsonError(w http.ResponseWriter, msg string, statusCode int)
- type HTTPError
- func NewBadRequestError(message string, cause error) *HTTPError
- func NewForbiddenError(message string, cause error) *HTTPError
- func NewHTTPError(statusCode int, message string, cause error) *HTTPError
- func NewInternalServerError(message string, cause error) *HTTPError
- func NewNotFoundError(message string, cause error) *HTTPError
- type HTTPStatusError
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func WriteError ¶
func WriteError(w http.ResponseWriter, err error, defaultStatusCode int)
WriteError writes any error to the response, checking for HTTPStatusError interface If the error implements HTTPStatusError, uses its status code, otherwise uses defaultStatusCode
func WriteJsonError ¶
func WriteJsonError(w http.ResponseWriter, msg string, statusCode int)
Types ¶
type HTTPError ¶
HTTPError represents an error with an associated HTTP status code
func NewBadRequestError ¶
Common HTTP error constructors
func NewForbiddenError ¶
func NewHTTPError ¶
NewHTTPError creates a new HTTPError
func NewInternalServerError ¶
func NewNotFoundError ¶
func (*HTTPError) GetStatusCode ¶
type HTTPStatusError ¶
HTTPStatusError interface for errors that have an associated HTTP status code
Click to show internal directories.
Click to hide internal directories.