errors

package
v2.10.1+incompatible Latest Latest
Warning

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

Go to latest
Published: Mar 18, 2019 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BuildGRPCError

func BuildGRPCError(err error) error

BuildGRPCError returns the error with a GRPC code

func FromGRPCError

func FromGRPCError(err error) error

FromGRPCError creates a regular error with the same type as the gRPC error

func IsAlreadyExists

func IsAlreadyExists(err error) bool

IsAlreadyExists returns whether error type is AlreadyExists

func IsInternal

func IsInternal(err error) bool

IsInternal returns whether error type is Internal

func IsInvalidArgument

func IsInvalidArgument(err error) bool

IsInvalidArgument returns whether error type is InvalidArgument

func IsNotFound

func IsNotFound(err error) bool

IsNotFound returns whether error type is NotFound

func IsPermissionDenied

func IsPermissionDenied(err error) bool

IsPermissionDenied returns whether error type is PermissionDenied

func New

func New(message string) error

New returns an error with the supplied message. New also records the stack trace at the point it was called.

func NewErrAlreadyExists

func NewErrAlreadyExists(entity string) error

NewErrAlreadyExists returns a new ErrAlreadyExists for the given entitiy

func NewErrInternal

func NewErrInternal(message string) error

NewErrInternal returns a new ErrInternal with the given message

func NewErrInvalidArgument

func NewErrInvalidArgument(argument string, reason string) error

NewErrInvalidArgument returns a new ErrInvalidArgument for the given entitiy

func NewErrNotFound

func NewErrNotFound(entity string) error

NewErrNotFound returns a new ErrNotFound for the given entitiy

func NewErrPermissionDenied

func NewErrPermissionDenied(reason string) error

NewErrPermissionDenied returns a new ErrPermissionDenied with the given reason

func Wrap

func Wrap(err error, message string) error

Wrap returns an error annotating err with message. If err is nil, Wrap returns nil.

func Wrapf

func Wrapf(err error, format string, args ...interface{}) error

Wrapf returns an error annotating err with the format specifier. If err is nil, Wrapf returns nil.

Types

type ErrAlreadyExists

type ErrAlreadyExists struct {
	// contains filtered or unexported fields
}

ErrAlreadyExists indicates that an entity already exists

func (ErrAlreadyExists) Error

func (err ErrAlreadyExists) Error() string

Error implements the error interface

type ErrInternal

type ErrInternal struct {
	// contains filtered or unexported fields
}

ErrInternal indicates that an internal error occured

func (ErrInternal) Error

func (err ErrInternal) Error() string

Error implements the error interface

type ErrInvalidArgument

type ErrInvalidArgument struct {
	// contains filtered or unexported fields
}

ErrInvalidArgument indicates that an argument was invalid

func (ErrInvalidArgument) Error

func (err ErrInvalidArgument) Error() string

Error implements the error interface

type ErrNotFound

type ErrNotFound struct {
	// contains filtered or unexported fields
}

ErrNotFound indicates that an entity was not found

func (ErrNotFound) Error

func (err ErrNotFound) Error() string

Error implements the error interface

type ErrPermissionDenied

type ErrPermissionDenied struct {
	// contains filtered or unexported fields
}

ErrPermissionDenied indicates that permissions were not sufficient

func (ErrPermissionDenied) Error

func (err ErrPermissionDenied) Error() string

Error implements the error interface

type ErrType

type ErrType string
const (
	AlreadyExists    ErrType = "already exists"
	Internal         ErrType = "internal"
	InvalidArgument  ErrType = "invalid argument"
	NotFound         ErrType = "not found"
	OutOfRange       ErrType = "out of range"
	PermissionDenied ErrType = "permission denied"
	Unknown          ErrType = "unknown"
)

These constants represent error types

func GetErrType

func GetErrType(err error) ErrType

GetErrType returns the type of err

Jump to

Keyboard shortcuts

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