Documentation ¶
Index ¶
- Variables
- func AsValue(ptr interface{}, err error) bool
- func Errorc(code Code, msg string) error
- func Errorcf(code Code, f string, args ...interface{}) error
- func Errorf(f string, args ...interface{}) error
- func Is(err, target error) bool
- func New(msg string) error
- func NewBase(code Code, msg string) *baseError
- func WithCode(err error, code Code) error
- func WithStack(e error) error
- func Wrap(e error, msg string) error
- func Wrapc(e error, c Code, msg string) error
- func Wrapcf(e error, c Code, f string, args ...interface{}) error
- func Wrapf(e error, f string, args ...interface{}) error
- type Code
- type ErrorCoder
- type Unwrapper
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrUnknown = NewBase(UnknownError, "UnknownError") ErrIllegalArgument = NewBase(IllegalArgumentError, "IllegalArgument") ErrInvalidState = NewBase(InvalidStateError, "InvalidState") ErrUnsupported = NewBase(UnsupportedError, "Unsupported") ErrNotFound = NewBase(NotFoundError, "NotFound") ErrInvalidNetwork = NewBase(InvalidNetworkError, "InvalidNetwork") ErrTimeout = NewBase(TimeoutError, "Timeout") )
Functions ¶
func AsValue ¶
AsValue checks whether the err is caused by specified typed error, and store it to the ptr.
Types ¶
type Code ¶
type Code int
const ( UnknownError Code = CodeGeneral + iota IllegalArgumentError UnsupportedError InvalidStateError NotFoundError InvalidNetworkError TimeoutError )
type ErrorCoder ¶
func CoderOf ¶
func CoderOf(e error) (ErrorCoder, bool)
Click to show internal directories.
Click to hide internal directories.