Documentation
¶
Overview ¶
errgo is a package that provides an easy way to annotate errors without losing the orginal error context.
Index ¶
- Variables
- func Annotate(err error, message string) error
- func Annotatef(err error, format string, args ...interface{}) error
- func Check(err error, checker func(error) bool) bool
- func DetailedErrorStack(err error, params OutputParams) string
- func GetErrorStack(err error) []error
- func New(format string, args ...interface{}) error
- func Trace(err error) error
- func Translate(err, newError error, message string) error
- func Translatef(err, newError error, format string, args ...interface{}) error
- type OutputParams
Constants ¶
This section is empty.
Variables ¶
var Default = OutputParams{FileDepth: 2}
Default is a simple pre-defined params for the DetailedErrorStack method that has no prefix, and shows files to a depth of one.
Functions ¶
func Annotate ¶
Annotate is used to add extra context to an existing error. The location of the Annotate call is recorded with the annotations. The file, line and function are also recorded.
func Annotatef ¶
Annotatef operates like Annotate, but uses the a format and args that match the fmt package.
func DetailedErrorStack ¶
func DetailedErrorStack(err error, params OutputParams) string
DetailedErrorStack gives a slice containing the detailed error stack, annotation and original error, along with the location if it was recorded.
func GetErrorStack ¶
GetErrorStack returns a slice of errors stored in the annotated errors. If the error isn't an annotated error, a slice with a single value is returned.
func Translatef ¶
Translatef operates like Translate, but uses the a format and args that match the fmt package.
Types ¶
type OutputParams ¶
OutputParams are used to control the look of the DetailedErrorStack.