github.com/corestoreio/errors (go): Package errors provides simple error handling primitives and behavioral errors.  Hello there! Read the presentation http://dave.cheney.net/paste/gocon-spring-2016.pdf to see what the big deal is.  http://dave.cheney.net/2016/04/27/dont-just-check-errors-handle-them-gracefully  Read this for asserting errors for their behaviour http://dave.cheney.net/2014/12/24/inspecting-errors  The traditional error handling idiom in Go is roughly akin to  which applied recursively up the call stack results in error reports without context or debugging information. The errors package allows programmers to add context to the failure path in their code in a way that does not destroy the original value of the error.  The errors.Wrap function returns a new error that adds context to the original error by recording a stack trace at the point Wrap is called, and the supplied message. For example  If additional control is required the errors.WithStack and errors.WithMessage functions destructure errors.Wrap into its component operations of annotating an error with a stack trace and an a message, respectively.  Using errors.Wrap constructs a stack of errors, adding context to the preceding error. Depending on the nature of the error it may be necessary to reverse the operation of errors.Wrap to retrieve the original error for inspection. Any error value which implements this interface  can be inspected by errors.Cause. errors.Cause will recursively retrieve the topmost error which does not implement causer, which is assumed to be the original cause. For example:  causer interface is not exported by this package, but is considered a part of stable public API.  All error values returned from this package implement fmt.Formatter and can be formatted by the fmt package. The following verbs are supported  New, Errorf, Wrap, and Wrapf record a stack trace at the point they are invoked. This information can be retrieved with the following interface.  Where errors.StackTrace is defined as  The Frame type represents a call site in the stack trace. Frame supports the fmt.Formatter interface that can be used for printing information about the stack trace of this error. For example:  stackTracer interface is not exported by this package, but is considered a part of stable public API.  See the documentation for Frame.Format for more details.
Keywords: behaviour|behavioural|errors|golang|stacktrace