Documentation
¶
Overview ¶
Package errors provides multi error, error wrapping. It defines error category code for machine post processing
Index ¶
- Constants
- func Errorf(format string, args ...interface{}) error
- func IsRuntimeError(err error) bool
- func New(msg string) error
- func Wrap(err error, msg string) error
- func Wrapf(err error, format string, args ...interface{}) error
- type FreshError
- type MultiErr
- type Stack
- type TracedError
- type WrappedError
Examples ¶
Constants ¶
View Source
const ( // MultiErrSep is the separator used when returning a slice of errors as single line message MultiErrSep = "; " // ErrCauseSep is the separator used when returning a error with causal chain as single line message ErrCauseSep = ": " )
Variables ¶
This section is empty.
Functions ¶
func IsRuntimeError ¶
Types ¶
type FreshError ¶
type FreshError struct {
// contains filtered or unexported fields
}
func (*FreshError) Error ¶
func (fresh *FreshError) Error() string
func (*FreshError) ErrorStack ¶
func (fresh *FreshError) ErrorStack() *Stack
type MultiErr ¶
type MultiErr interface {
error
fmt.Formatter
// Append returns true if the appended error is not nil, inspired by https://github.com/uber-go/multierr/issues/21
Append(error) bool
Errors() []error
// Error returns itself or nil if there are no errors, inspired by https://github.com/hashicorp/go-multierror
ErrorOrNil() error
// HasError is ErrorOrNil != nil
HasError() bool
}
Example ¶
err := NewMultiErr() err.Append(os.ErrPermission) err.Append(os.ErrNotExist) fmt.Println(err.Errors())
Output: [permission denied file does not exist]
func NewMultiErr ¶
func NewMultiErr() MultiErr
func NewMultiErrSafe ¶
func NewMultiErrSafe() MultiErr
type TracedError ¶
type WrappedError ¶
type WrappedError struct {
// contains filtered or unexported fields
}
func (*WrappedError) Error ¶
func (wrapped *WrappedError) Error() string
func (*WrappedError) ErrorStack ¶
func (wrapped *WrappedError) ErrorStack() *Stack
Click to show internal directories.
Click to hide internal directories.