errors

package
v2.24.2 Latest Latest
Warning

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

Go to latest
Published: Jan 7, 2025 License: MIT Imports: 6 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func As

func As(err error, target any) bool

func GetBase added in v2.23.1

func GetBase(err error) error

GetBase returns the original error from the passed tagged error

func GetStackTrace

func GetStackTrace() []string

GetStackTrace retrieves the full stack (minus any runtime related functions) from where the Error was instantiated

func Is

func Is(err, target error) bool

Types

type ErrInvalidArgument added in v2.24.2

type ErrInvalidArgument string

ErrInvalidArgument value for the expected functionality.

func (ErrInvalidArgument) Error added in v2.24.2

func (e ErrInvalidArgument) Error() string

func (ErrInvalidArgument) GetCode added in v2.24.2

func (e ErrInvalidArgument) GetCode() codes.Code

type ErrNotFound added in v2.24.2

type ErrNotFound string

ErrNotFound is returned when a resource does not exist for a given identifier.

func (ErrNotFound) Error added in v2.24.2

func (e ErrNotFound) Error() string

func (ErrNotFound) GetCode added in v2.24.2

func (e ErrNotFound) GetCode() codes.Code

type ErrParameterRequired added in v2.23.1

type ErrParameterRequired string

ErrParameterRequired is returned when a required parameter is empty or nil but requires a value.

func (ErrParameterRequired) Error added in v2.23.1

func (e ErrParameterRequired) Error() string

func (ErrParameterRequired) GetCode added in v2.23.1

func (e ErrParameterRequired) GetCode() codes.Code

type ErrRequiresSuperUser added in v2.23.1

type ErrRequiresSuperUser string

ErrRequiresSuperUser is returned when a user attempts to perform an action that requires superuser privileges.

func (ErrRequiresSuperUser) Error added in v2.23.1

func (e ErrRequiresSuperUser) Error() string

func (ErrRequiresSuperUser) GetCode added in v2.23.1

func (e ErrRequiresSuperUser) GetCode() codes.Code

type ErrTesting added in v2.23.1

type ErrTesting string

ErrTesting is for use in error test cases only. Should primarily be used for returning generic errors from mocks and ensuring the error is expected

func (ErrTesting) Error added in v2.23.1

func (e ErrTesting) Error() string

func (ErrTesting) GetCode added in v2.23.1

func (e ErrTesting) GetCode() codes.Code

type HasCode added in v2.23.1

type HasCode interface {
	error
	// GetCode for this error
	GetCode() codes.Code
}

HasCode exposes functionality for switching from an error to a status error

type TaggedError added in v2.24.1

type TaggedError interface {
	error
	// GetGRPCStatus returns the status.Status for this error
	GRPCStatus() *status.Status
}

TaggedError is an error that has been tagged with a status.Status

func Tag added in v2.23.1

func Tag(tag string, base HasCode) TaggedError

Tag the passed error

func TagAndCode added in v2.23.1

func TagAndCode(tag string, code codes.Code, base error) TaggedError

TagAndCode the passed error

type Tracer

type Tracer interface {
	// Trace returns the long format stack trace from where the error was instantiated
	Trace() []string
}

Tracer provides a stack trace

type TracerError

type TracerError interface {
	Tracer
	error
}

TracerError is an amalgamation of the Tracer and error interfaces

func New

func New(message string) TracerError

New instantiates a TracerError with a message and a stack trace

func Newf added in v2.24.0

func Newf(format string, args ...interface{}) TracerError

Newf instantiates a TracerError with a formatted message and a stack trace

func Wrap

func Wrap(err error) TracerError

Wrap an existing error in a TracerError

Jump to

Keyboard shortcuts

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