errors

package
v2.4.0+incompatible Latest Latest
Warning

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

Go to latest
Published: Feb 3, 2017 License: MIT Imports: 7 Imported by: 332

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 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