errors

package
v0.28.22 Latest Latest
Warning

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

Go to latest
Published: Oct 25, 2023 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsError

func IsError(actual error, expected error) bool

Returns true if actual is the same type of error as expected. This method unwraps the given error objects (if they are wrapped in objects with a stacktrace) and then does a simple equality check on them.

func NewMultiError added in v0.14.4

func NewMultiError(errs ...error) error

func PrintErrorWithStackTrace

func PrintErrorWithStackTrace(err error) string

Convert the given error to a string, including the stack trace if available

func Recover

func Recover(onPanic func(cause error))

A method that tries to recover from panics, and if it succeeds, calls the given onPanic function with an error that explains the cause of the panic. This function should only be called from a defer statement.

func Unwrap

func Unwrap(err error) error

If the given error is a wrapper that contains a stacktrace, unwrap it and return the original, underlying error. In all other cases, return the error unchanged

func WithStackTrace

func WithStackTrace(err error) error

Wrap the given error in an Error type that contains the stack trace. If the given error already has a stack trace, it is used directly. If the given error is nil, return nil.

func WithStackTraceAndPrefix

func WithStackTraceAndPrefix(err error, message string, args ...interface{}) error

Wrap the given error in an Error type that contains the stack trace and has the given message prepended as part of the error message. If the given error already has a stack trace, it is used directly. If the given error is nil, return nil.

Types

type IErrorCode added in v0.12.14

type IErrorCode interface {
	ExitStatus() (int, error)
}

Interface to determine if we can retrieve an exit status from an error

type MultiError added in v0.14.4

type MultiError struct {
	Errors []error
}

func (MultiError) Error added in v0.14.4

func (errs MultiError) Error() string

Jump to

Keyboard shortcuts

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