Documentation ¶
Overview ¶
Package errors holds some of the defined wrappers to handle specific type of errors.
Index ¶
- Constants
- func IsBadParameterError(err error) (bool, error)
- func IsConversionError(err error) (bool, error)
- func IsForbiddenError(err error) (bool, error)
- func IsInternalError(err error) (bool, error)
- func IsNotFoundError(err error) (bool, error)
- func IsUnauthorizedError(err error) (bool, error)
- func IsVersionConflictError(err error) (bool, error)
- type BadParameterError
- type ConversionError
- type ForbiddenError
- type InternalError
- type NotFoundError
- type UnauthorizedError
- type VersionConflictError
Constants ¶
const (
ErrInternalDatabase = "database_error"
)
Constants that can be used to identify internal server errors
Variables ¶
This section is empty.
Functions ¶
func IsBadParameterError ¶
IsBadParameterError returns true if the cause of the given error can be converted to an BadParameterError, which is returned as the second result.
func IsConversionError ¶
IsConversionError returns true if the cause of the given error can be converted to an ConversionError, which is returned as the second result.
func IsForbiddenError ¶
IsForbiddenError returns true if the cause of the given error can be converted to an ForbiddenError, which is returned as the second result.
func IsInternalError ¶
IsInternalError returns true if the cause of the given error can be converted to an InternalError, which is returned as the second result.
func IsNotFoundError ¶
IsNotFoundError returns true if the cause of the given error can be converted to an NotFoundError, which is returned as the second result.
func IsUnauthorizedError ¶
IsUnauthorizedError returns true if the cause of the given error can be converted to an UnauthorizedError, which is returned as the second result.
func IsVersionConflictError ¶
IsVersionConflictError returns true if the cause of the given error can be converted to an VersionConflictError, which is returned as the second result.
Types ¶
type BadParameterError ¶
type BadParameterError struct {
// contains filtered or unexported fields
}
BadParameterError means that a parameter was not as required
func NewBadParameterError ¶
func NewBadParameterError(param string, actual interface{}) BadParameterError
NewBadParameterError returns the custom defined error of type NewBadParameterError.
func (BadParameterError) Error ¶
func (err BadParameterError) Error() string
Error implements the error interface
func (BadParameterError) Expected ¶
func (err BadParameterError) Expected(expexcted interface{}) BadParameterError
Expected sets the optional expectedValue parameter on the BadParameterError
type ConversionError ¶
type ConversionError struct {
// contains filtered or unexported fields
}
ConversionError error means something went wrong converting between different representations
func NewConversionError ¶
func NewConversionError(msg string) ConversionError
NewConversionError returns the custom defined error of type NewConversionError.
type ForbiddenError ¶
type ForbiddenError struct {
// contains filtered or unexported fields
}
ForbiddenError means that the operation is forbidden
func NewForbiddenError ¶
func NewForbiddenError(msg string) ForbiddenError
NewForbiddenError returns the custom defined error of type ForbiddenError.
type InternalError ¶
type InternalError struct {
Err error
}
InternalError means that the operation failed for some internal, unexpected reason
func NewInternalError ¶
func NewInternalError(ctx context.Context, err error) InternalError
NewInternalError returns the custom defined error of type InternalError.
func (InternalError) Error ¶
func (ie InternalError) Error() string
type NotFoundError ¶
type NotFoundError struct { ID string // contains filtered or unexported fields }
NotFoundError means the object specified for the operation does not exist
func NewNotFoundError ¶
func NewNotFoundError(entity string, id string) NotFoundError
NewNotFoundError returns the custom defined error of type NewNotFoundError.
func (NotFoundError) Error ¶
func (err NotFoundError) Error() string
type UnauthorizedError ¶
type UnauthorizedError struct {
// contains filtered or unexported fields
}
UnauthorizedError means that the operation is unauthorized
func NewUnauthorizedError ¶
func NewUnauthorizedError(msg string) UnauthorizedError
NewUnauthorizedError returns the custom defined error of type UnauthorizedError.
type VersionConflictError ¶
type VersionConflictError struct {
// contains filtered or unexported fields
}
VersionConflictError means that the version was not as expected in an update operation
func NewVersionConflictError ¶
func NewVersionConflictError(msg string) VersionConflictError
NewVersionConflictError returns the custom defined error of type VersionConflictError.