Documentation ¶
Overview ¶
Package errors supports generic rich error reporting.
This package is deprecated. Since it was written much better approaches have been developed.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Cause ¶
Cause returns the initially identified cause of an error if the error is a Chain, or the error itself if it is not.
Types ¶
type Chain ¶
type Chain interface { // The error behavior of a Chain is based on the last annotation applied. error // Cause returns the initial error in the Chain. Cause() error // Link adds an annotation layer to the Chain. Link(error) Chain // Last returns the Chain, or nil if the Chain is empty, and the most recent annotation. Last() (Chain, error) }
Chain is an error and layered error annotations.
func Last ¶
Last returns the most recent annotation of an error and the remaining chain after the annotation is removed or nil if no further errors remain. Last returns a nil Chain if the error is not a Chain.
type Error ¶
type Error interface { // FileLine returns the file name and line number of caller // stored at creation of the Error. FileLine() (file string, line int) // Trace returns a slice continuing the stack trace stored at // creation of the Error. Trace() (stack []*runtime.Func) // Package returns the package name of the stored caller. Package() string // Function returns the function name of the stored caller. Function() string // Items returns any items retained by caller. Items() []interface{} // Tracef returns a formatted stack trace of the error // extending depth frames into the stack, 0 indicates no limit. Tracef(depth int) string error }
Type Error is the interface for rich error reporting supported by the errors package.
Click to show internal directories.
Click to hide internal directories.