Documentation ¶
Index ¶
- func IsBadRequestError(err error) bool
- func IsConflictError(err error) bool
- func IsForbiddenError(err error) bool
- func IsInternalServerError(err error) bool
- func IsNotFoundError(err error) bool
- func IsUnauthorizedError(err error) bool
- func IsUnknownError(err error) bool
- type APIStatus
- type KnownReason
- type Status
- type StatusError
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func IsBadRequestError ¶
IsBadRequestError checks if error is of type `bad request`
func IsConflictError ¶
IsConflictError checks if error is of type `conflict`
func IsForbiddenError ¶
IsForbiddenError checks if error is of type `forbidden`
func IsInternalServerError ¶
IsInternalServerError checks if error is of type `internal server error`
func IsNotFoundError ¶
IsNotFoundError checks if error is of type `not found`
func IsUnauthorizedError ¶
IsUnauthorizedError checks if error is of type `unauthorized`
func IsUnknownError ¶
IsUnknownError checks if error is of type `unknown`
Types ¶
type APIStatus ¶
type APIStatus interface {
Status() Status
}
func AsAPIStatus ¶
AsAPIStatus checks if the error is of type `APIStatus` and returns nil if not
type KnownReason ¶
type KnownReason int
const ( KnownReasonBadRequest KnownReason = iota KnownReasonForbidden KnownReasonNotFound KnownReasonConflict KnownReasonInternalServerError KnownReasonUnknown )
type StatusError ¶
type StatusError struct {
ErrStatus Status
}
func NewBadRequest ¶
func NewBadRequest(details string) *StatusError
NewBadRequest creates a new StatusError with error code 400
func NewConflict ¶
func NewConflict(details string) *StatusError
NewConflict creates a new StatusError with error code 409
func NewForbidden ¶
func NewForbidden(details string) *StatusError
NewForbidden creates a new StatusError with error code 403
func NewInternalServerError ¶
func NewInternalServerError(details string) *StatusError
NewInternalServerError creates a new StatusError with error code 500
func NewNotFound ¶
func NewNotFound(details string) *StatusError
NewNotFound creates a new StatusError with error code 404
func NewUnauthorized ¶
func NewUnauthorized(details string) *StatusError
NewUnauthorized creates a new StatusError with error code 401
func (*StatusError) Error ¶
func (se *StatusError) Error() string
func (*StatusError) Status ¶
func (se *StatusError) Status() Status