Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type WrapErrorFunc ¶
func New ¶
func New(msg string) (base error, wrap WrapErrorFunc)
Create a function that wraps errors from third-party sources. Those wrapped errors also satisfy errors.Is(err, Base)
Base is a new well-known error that should be a public field of your package, so users can test errors.Is(err, Base)
Example:
var WrongTime, wrapWrongTime = wrapped.New("wrong time")
func foo() error { ... if err != nil { return wrapWrongTime(err) } }
Click to show internal directories.
Click to hide internal directories.