Documentation
¶
Overview ¶
Package errors provides error management.
By convention, wrapping functions return a nil error if the given error is nil.
Index ¶
- func As(err error, target any) bool
- func Is(err, target error) bool
- func Message(err error, msg string) error
- func Messagef(err error, format string, args ...any) error
- func New(msg string) error
- func Newf(format string, args ...any) error
- func Stack(err error) error
- func StackFrames(err error) []*runtime.Frames
- func Unwrap(err error) error
- func Verbose(w io.Writer, err error)
- func VerboseFormatter(err error) fmt.Formatter
- func VerboseString(err error) string
- func Wrap(err error, msg string) error
- func Wrapf(err error, format string, args ...any) error
- type Verboser
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Message ¶
Message adds a message to an error.
The error message is "<msg>: <err>".
If the given message is empty, the returned error is the given error.
func StackFrames ¶
StackFrames returns the list of runtime.Frames associated to an error.
func Verbose ¶
Verbose writes the error's verbose message to the writer.
The first line is the error's message. The following lines are the verbose message of the error chain.
func VerboseFormatter ¶ added in v0.0.2
VerboseFormatter returns a fmt.Formatter that writes the error's verbose message.
func VerboseString ¶
VerboseString returns the error's verbose message as a string.
Types ¶
type Verboser ¶
type Verboser interface {
// ErrorVerbose writes the verbose message of the error to the writer.
// It must only write the verbose message of the error, not the error chain.
// It is responsible for writing a new line character at the end.
ErrorVerbose(io.Writer)
}
Verboser is an error that provides verbose information.
It is used by Verbose().
Directories
¶
| Path | Synopsis |
|---|---|
|
Package errignore provides a way to mark errors as ignored.
|
Package errignore provides a way to mark errors as ignored. |
|
Package errtag provides a way to add tags to errors.
|
Package errtag provides a way to add tags to errors. |
|
Package errtmp provides a way to mark errors as temporary.
|
Package errtmp provides a way to mark errors as temporary. |
|
Package errval provides a way to add values to errors.
|
Package errval provides a way to add values to errors. |