Documentation ¶
Overview ¶
Example ¶
package main import "github.com/gdey/errors" // ErrSentinel is an example of a sentinel errors that is a constants const ErrSentinel = errors.String("sentinel") func aOops() error { return ErrSentinel } func bOops() error { return errors.Wrap(aOops(), "error calling a") } func main() { var err error = errors.Wrap(ErrSentinel, "top wrap") _ = err }
Output:
Index ¶
Examples ¶
Constants ¶
View Source
const ErrCanceled = String("cancelled")
Canceled is used as a sentinel error to allow things to state that the operation was cancelled.
View Source
const ErrNilObject = String("nil receiver object")
NilObject is used as a sentinel error to allow things to state that the receiver object of the method is nil
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Err ¶
type Err interface { // Error is the human readable version of the error. // the main use should be for log files and printing // on screen. To compare errors use IsEqual. Error() string // Cause should return the error that this error wraps // if it wraps an error, or nil. Cause() error }
Click to show internal directories.
Click to hide internal directories.