tracederrors

package
v0.448.0 Latest Latest
Warning

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

Go to latest
Published: Sep 5, 2025 License: Apache-2.0 Imports: 5 Imported by: 0

README

tracederrors package

Provides errors with stacktrace and other additional information to help debugging after crashes where only logs are available.

Error wrapping by directly passing errors or using the %w format string in TracedErrorf is supported. TracedErrors give you a nice debug output including the stack trace in a human readable form compatiple to VSCode (affected sources can directly be opened from Terminal).

Examples

For developers

To run the tests use:

bash -c "cd $(git rev-parse --show-toplevel) && go test -v ./pkg/tracederrors/..."

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrTracedError = errors.New("asciichgolangpublic TracedError base")
View Source
var ErrTracedErrorEmptyString = errors.New("asciichgolangpublic TracedError empty string")
View Source
var ErrTracedErrorNil = errors.New("asciichgolangpublic TracedError nil")
View Source
var ErrTracedErrorNotImplemented = errors.New("asciichgolangpublic TracedError not implemented")

Functions

func AddErrorToUnwrapToTracedError

func AddErrorToUnwrapToTracedError(tracedError error, errorToAdd error) error

func IsEmptyStringError

func IsEmptyStringError(err error) (isEmptyStringError bool)

func IsNilError

func IsNilError(err error) (IsNilError bool)

func IsNotImplementedError

func IsNotImplementedError(err error) (isNotImplementedError bool)

func IsTracedError

func IsTracedError(err error) (isTracedError bool)

Returns true if given error 'err' is a TracedError, false otherwise.

func TracedError

func TracedError(errorMessageOrError interface{}) (tracedError error)

Create a new error with given error or error message. TracedErrors extends the error message by a human readable stack trace.

func TracedErrorEmptyString

func TracedErrorEmptyString(stringVarName string, errorToUnwrap ...error) (tracedError error)

func TracedErrorNil

func TracedErrorNil(nilVarName string) (tracedError error)

func TracedErrorNilf

func TracedErrorNilf(formatString string, args ...interface{}) (tracedError error)

func TracedErrorNotImplemented

func TracedErrorNotImplemented() (tracedError error)

func TracedErrorf

func TracedErrorf(formatString string, args ...interface{}) (tracedError error)

Create a new error with given error or error message. TracedErrors extends the error message by a human readable stack trace. Error wrapping using '%w' in format string is supported.

func UnwrapRecursive

func UnwrapRecursive(errorToUnwrap error) (errors []error)

Types

type TracedErrorType

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

func GetAsTracedError

func GetAsTracedError(errorToConvert error) (tracedError *TracedErrorType, err error)

func NewTracedErrorType

func NewTracedErrorType() (t *TracedErrorType)

func (TracedErrorType) Error

func (t TracedErrorType) Error() (errorMessage string)

func (TracedErrorType) GetErrorMessage

func (t TracedErrorType) GetErrorMessage() (errorMessage string, err error)

func (TracedErrorType) GetErrorsToUnwrap

func (t TracedErrorType) GetErrorsToUnwrap() (errorsToUnwrap []error, err error)

func (TracedErrorType) GetFormattedError

func (t TracedErrorType) GetFormattedError() (formattedError error, err error)

func (TracedErrorType) GetFunctionCalls

func (t TracedErrorType) GetFunctionCalls() (functionCalls []string, err error)

func (*TracedErrorType) SetErrorsToUnwrap

func (t *TracedErrorType) SetErrorsToUnwrap(errorsToUnwrap []error) (err error)

func (*TracedErrorType) SetFormattedError

func (t *TracedErrorType) SetFormattedError(formattedError error) (err error)

func (*TracedErrorType) SetFunctionCalls

func (t *TracedErrorType) SetFunctionCalls(functionCalls []string) (err error)

func (TracedErrorType) Unwrap

func (t TracedErrorType) Unwrap() (errors []error)

Jump to

Keyboard shortcuts

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