errors

package
v2.23.1 Latest Latest
Warning

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

Go to latest
Published: Oct 28, 2024 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

func Tag added in v2.23.1

func Tag(tag string, base HasCode) error

Tag the passed error

func TagAndCode added in v2.23.1

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

TagAndCode the passed error

Types

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

func (ErrRequiresSuperUser) Trace added in v2.23.1

func (e ErrRequiresSuperUser) Trace() string

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 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(format string, args ...interface{}) TracerError

New instantiates a TracerError with 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