Documentation ¶
Index ¶
- func IsBadRequest(httperr *HTTPErrorResponse) bool
- func IsConflict(httperr *HTTPErrorResponse) bool
- func IsForbidden(httperr *HTTPErrorResponse) bool
- func IsInternalServerError(httperr *HTTPErrorResponse) bool
- func IsNotFound(httperr *HTTPErrorResponse) bool
- func IsUnauthorized(httperr *HTTPErrorResponse) bool
- func IsUnprocessableEntity(httperr *HTTPErrorResponse) bool
- type HTTPErrorResponse
- func BadRequest(err error) *HTTPErrorResponse
- func Conflict(err error) *HTTPErrorResponse
- func Forbidden(err error) *HTTPErrorResponse
- func FromDefaultResponse(statusCode *int32, message *string, err error) *HTTPErrorResponse
- func InternalServerError(err error) *HTTPErrorResponse
- func NewHTTPError(code int, err error) *HTTPErrorResponse
- func NotFound(err error) *HTTPErrorResponse
- func Unauthorized(err error) *HTTPErrorResponse
- func UnconventionalError(err error) *HTTPErrorResponse
- func UnknownError(err error) *HTTPErrorResponse
- func UnprocessableEntity(err error) *HTTPErrorResponse
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func IsBadRequest ¶
func IsBadRequest(httperr *HTTPErrorResponse) bool
IsBadRequest returns true if the error is a bad request error
func IsConflict ¶
func IsConflict(httperr *HTTPErrorResponse) bool
IsConflict returns true if the error is a conflict error
func IsForbidden ¶
func IsForbidden(httperr *HTTPErrorResponse) bool
IsForbidden returns true if the error is a forbidden error
func IsInternalServerError ¶
func IsInternalServerError(httperr *HTTPErrorResponse) bool
IsInternalServerError returns true if the error is an internal server error
func IsNotFound ¶
func IsNotFound(httperr *HTTPErrorResponse) bool
IsNotFound returns true if the error is a not found error
func IsUnauthorized ¶
func IsUnauthorized(httperr *HTTPErrorResponse) bool
IsUnauthorized returns true if the error is an unauthorized error
func IsUnprocessableEntity ¶
func IsUnprocessableEntity(httperr *HTTPErrorResponse) bool
IsUnprocessableEntity returns true if the error is an unprocessable entity error
Types ¶
type HTTPErrorResponse ¶
type HTTPErrorResponse struct { StatusCode int `json:"statuscode" description:"http status code"` Message string `json:"message" description:"error message"` }
HTTPErrorResponse is returned in case of functional errors.
func BadRequest ¶
func BadRequest(err error) *HTTPErrorResponse
BadRequest creates a new bad request error with a given error message. Convenience Method.
func Conflict ¶
func Conflict(err error) *HTTPErrorResponse
Conflict creates a new conflict error with a given error message. Convenience Method.
func Forbidden ¶
func Forbidden(err error) *HTTPErrorResponse
Forbidden creates a new forbidden response with a given error message. Convenience Method.
func FromDefaultResponse ¶
func FromDefaultResponse(statusCode *int32, message *string, err error) *HTTPErrorResponse
FromDefaultResponse creates an error response from a client default http error response. Returns an unconventional error if response could not be unmarshaled.
func InternalServerError ¶
func InternalServerError(err error) *HTTPErrorResponse
InternalServerError creates a new internal server error with a given error message. Convenience Method.
func NewHTTPError ¶
func NewHTTPError(code int, err error) *HTTPErrorResponse
NewHTTPError creates a new http error.
func NotFound ¶
func NotFound(err error) *HTTPErrorResponse
NotFound creates a new notfound error with a given error message. Convenience Method.
func Unauthorized ¶
func Unauthorized(err error) *HTTPErrorResponse
Unauthorized creates a new unauthorized response with a given error message. Convenience Method.
func UnconventionalError ¶
func UnconventionalError(err error) *HTTPErrorResponse
UnconventionalError creates a new error with a given error message for a response that did not follow the internal error convention. Convenience Method.
func UnknownError ¶
func UnknownError(err error) *HTTPErrorResponse
UnknownError creates a new internal server error with a given error message. Convenience Method. Is actually also just an internal server error.
func UnprocessableEntity ¶
func UnprocessableEntity(err error) *HTTPErrorResponse
UnprocessableEntity creates a new unprocessable entity request error with a given error message. Convenience Method.
func (*HTTPErrorResponse) Error ¶ added in v0.3.2
func (h *HTTPErrorResponse) Error() string
func (*HTTPErrorResponse) MarshalText ¶ added in v0.6.6
func (h *HTTPErrorResponse) MarshalText() ([]byte, error)
func (*HTTPErrorResponse) UnmarshalText ¶ added in v0.6.5
func (h *HTTPErrorResponse) UnmarshalText(text []byte) error