errors

package
v0.6.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 26, 2021 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FromHeader

func FromHeader(header *headers.ResponseHeader) error

FromHeader creates a typed error from a response header

func IsAlreadyExists

func IsAlreadyExists(err error) bool

IsAlreadyExists checks whether the given error is a AlreadyExists error

func IsCanceled

func IsCanceled(err error) bool

IsCanceled checks whether the given error is an Canceled error

func IsConflict

func IsConflict(err error) bool

IsConflict checks whether the given error is a Conflict error

func IsForbidden

func IsForbidden(err error) bool

IsForbidden checks whether the given error is a Forbidden error

func IsInternal

func IsInternal(err error) bool

IsInternal checks whether the given error is an Internal error

func IsInvalid

func IsInvalid(err error) bool

IsInvalid checks whether the given error is an Invalid error

func IsNotFound

func IsNotFound(err error) bool

IsNotFound checks whether the given error is a NotFound error

func IsNotSupported

func IsNotSupported(err error) bool

IsNotSupported checks whether the given error is a NotSupported error

func IsTimeout

func IsTimeout(err error) bool

IsTimeout checks whether the given error is a Timeout error

func IsType

func IsType(err error, t Type) bool

IsType checks whether the given error is of the given type

func IsUnauthorized

func IsUnauthorized(err error) bool

IsUnauthorized checks whether the given error is a Unauthorized error

func IsUnavailable

func IsUnavailable(err error) bool

IsUnavailable checks whether the given error is an Unavailable error

func IsUnknown

func IsUnknown(err error) bool

IsUnknown checks whether the given error is an Unknown error

func New

func New(t Type, msg string, args ...interface{}) error

New creates a new typed error

func NewAlreadyExists

func NewAlreadyExists(msg string) error

NewAlreadyExists returns a new AlreadyExists error

func NewCanceled

func NewCanceled(msg string) error

NewCanceled returns a new Canceled error

func NewConflict

func NewConflict(msg string) error

NewConflict returns a new Conflict error

func NewForbidden

func NewForbidden(msg string) error

NewForbidden returns a new Forbidden error

func NewInternal

func NewInternal(msg string) error

NewInternal returns a new Internal error

func NewInvalid

func NewInvalid(msg string) error

NewInvalid returns a new Invalid error

func NewNotFound

func NewNotFound(msg string) error

NewNotFound returns a new NotFound error

func NewNotSupported

func NewNotSupported(msg string) error

NewNotSupported returns a new NotSupported error

func NewTimeout

func NewTimeout(msg string) error

NewTimeout returns a new Timeout error

func NewUnauthorized

func NewUnauthorized(msg string) error

NewUnauthorized returns a new Unauthorized error

func NewUnavailable

func NewUnavailable(msg string) error

NewUnavailable returns a new Unavailable error

func NewUnknown

func NewUnknown(msg string) error

NewUnknown returns a new Unknown error

Types

type Type

type Type int

Type is an error type

const (
	// Unknown is an unknown error type
	Unknown Type = iota
	// Canceled indicates a request context was canceled
	Canceled
	// NotFound indicates a resource was not found
	NotFound
	// AlreadyExists indicates a resource already exists
	AlreadyExists
	// Unauthorized indicates access to a resource is not authorized
	Unauthorized
	// Forbidden indicates the operation requested to be performed on a resource is forbidden
	Forbidden
	// Conflict indicates a conflict occurred during concurrent modifications to a resource
	Conflict
	// Invalid indicates a message or request is invalid
	Invalid
	// Unavailable indicates a service is not available
	Unavailable
	// NotSupported indicates a method is not supported
	NotSupported
	// Timeout indicates a request timed out
	Timeout
	// Internal indicates an unexpected internal error occurred
	Internal
)

func TypeOf

func TypeOf(err error) Type

TypeOf returns the type of the given error

type TypedError

type TypedError struct {
	// Type is the error type
	Type Type
	// Message is the error message
	Message string
}

TypedError is an typed error

func (*TypedError) Error

func (e *TypedError) Error() string

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL