errors

package
v0.7.21 Latest Latest
Warning

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

Go to latest
Published: Oct 10, 2021 License: Apache-2.0 Imports: 5 Imported by: 253

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FromAtomix added in v0.6.25

func FromAtomix(err error) error

FromAtomix creates a typed error from an Atomix error

func FromGRPC added in v0.7.0

func FromGRPC(err error) error

FromGRPC creates a typed error from a gRPC error

func FromStatus

func FromStatus(status *status.Status) error

FromStatus creates a typed error from a gRPC status

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, args ...interface{}) error

NewAlreadyExists returns a new AlreadyExists error

func NewCanceled

func NewCanceled(msg string, args ...interface{}) error

NewCanceled returns a new Canceled error

func NewConflict

func NewConflict(msg string, args ...interface{}) error

NewConflict returns a new Conflict error

func NewForbidden

func NewForbidden(msg string, args ...interface{}) error

NewForbidden returns a new Forbidden error

func NewInternal

func NewInternal(msg string, args ...interface{}) error

NewInternal returns a new Internal error

func NewInvalid

func NewInvalid(msg string, args ...interface{}) error

NewInvalid returns a new Invalid error

func NewNotFound

func NewNotFound(msg string, args ...interface{}) error

NewNotFound returns a new NotFound error

func NewNotSupported

func NewNotSupported(msg string, args ...interface{}) error

NewNotSupported returns a new NotSupported error

func NewTimeout

func NewTimeout(msg string, args ...interface{}) error

NewTimeout returns a new Timeout error

func NewUnauthorized

func NewUnauthorized(msg string, args ...interface{}) error

NewUnauthorized returns a new Unauthorized error

func NewUnavailable

func NewUnavailable(msg string, args ...interface{}) error

NewUnavailable returns a new Unavailable error

func NewUnknown

func NewUnknown(msg string, args ...interface{}) error

NewUnknown returns a new Unknown error

func Status

func Status(err error) *status.Status

Status gets the gRPC status for the given 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