Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AttrsAll ¶
AttrsAll returns an iterator that iterates over the attributes of the given error and its parent ones. If the parent of the error has the same attribute key as the children, the children are iterated over the parent.
func New ¶
New creates a new error with given attributes. The attributes can be retrieved using AttrsAll. The error has a stacktrace of the callers. The stacktrace can be obtained via StackTraceOf. If you would like to create an error into a package variable, you must use NewSentinel.
func NewSentinel ¶
NewSentinel creates a new sentinel error. The sentinel error does not have a stacktrace, any attributes and an error code.
func StackTraceOf ¶
func StackTraceOf(err error) caller.StackTrace
StackTraceOf returns stacktrace of the given error. If err does not have stacktrace, StackTraceOf returns nil.
func WithCode ¶
WithCode creates a new error which associated with the given code and the parent error. The code can be obtained via CodeOf.
func Wrap ¶
Wrap creates a new wrapped error of the parent error with given attributes. The attributes can be retrieved using AttrsAll. The error has a stacktrace of the callers. The stacktrace can be obtained via StackTraceOf. Calling errors.Unwrap with the wrapped error returns the parent error.
Types ¶
type Code ¶
type Code struct {
// contains filtered or unexported fields
}
Code is an error code that can be associated with an error using WithCode.