Documentation
¶
Overview ¶
Package deeperr is a lightweight Go error-wrapping library designed to provide stack traces and error codes
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Contains ¶
Contains checks the entire chain and returns true if ANY deeperr.Error in the hierarchy matches the error code
func GetStacktrace ¶
GetStacktrace traverses the error chain and constructs a formatted string, representing the full execution path. for each error in the chain, it prints the error message and if the error is a deeperr.Error it will also print the location where the error was created.
func PrintStacktrace ¶
func PrintStacktrace(err error)
PrintStacktrace is a helper function that retrieves the full stack trace of an error and writes it directly to standard error (os.Stderr).
Types ¶
type Code ¶
type Code int
Code represents an error code
const CodeUnset Code = -1
CodeUnset means this error doesn't use a code
type Error ¶
type Error interface {
// Code returns the error code or `deeperr.CodeUnset`
Code() Code
// Message returns the error message
Message() string
// Error returns the error code and the error message
Error() string
// Unwrap returns the next error in the chain
Unwrap() error
// Location returns the location where the error was created
Location() (string, int)
}
Error is an error type with stack traces and error code tagging capabilities