Documentation
¶
Overview ¶
Package errors defines the errors used in multiple packages in common.
Index ¶
- func Cause(err error) error
- func Errorf(format string, args ...interface{}) error
- func New(text string) error
- func WithMessage(err error, message string) error
- func WithStack(err error) error
- func Wrap(err error, message string) error
- func Wrapf(err error, format string, args ...interface{}) error
- type ErrInvalidLength
- type ErrInvalidType
- type ErrReceiverNil
- type ErrTooShortToDecode
- type ErrUnsupported
- type Frame
- type StackTrace
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Cause ¶
Cause Cause returns the underlying cause of the error, if possible. An error value has a cause if it implements the following interface:
This function just wraps the Cause in pkg/errors library.
func Errorf ¶
Errorf formats according to a format specifier and returns the string as a value that satisfies error. Errorf also records the stack trace at the point it was called.
This function just wraps the Errorf in pkg/errors library.
func New ¶
New returns an error that formats as the given text.
This function just wraps the New in pkg/errors library.
func WithMessage ¶
WithMessage annotates err with a new message. If err is nil, WithMessage returns nil.
This function just wraps the WithMessage in pkg/errors library.
func WithStack ¶
WithStack annotates err with a stack trace at the point WithStack was called. If err is nil, WithStack returns nil.
This function just wraps the WithStack in pkg/errors library.
Types ¶
type ErrInvalidLength ¶
type ErrInvalidLength struct { Type interface{} Message string }
ErrInvalidLength indicates the value in Length field is invalid.
func NewErrInvalidLength ¶
func NewErrInvalidLength(rcvType interface{}, msg string) *ErrInvalidLength
NewErrInvalidLength creates a ErrInvalidLength.
func (*ErrInvalidLength) Error ¶
func (e *ErrInvalidLength) Error() string
Error returns the type of receiver and some additional message.
type ErrInvalidType ¶
ErrInvalidType indicates the value in Type/Code field is invalid.
func NewErrInvalidType ¶
func NewErrInvalidType(invalidType interface{}, action, msg string) *ErrInvalidType
NewErrInvalidType creates a ErrInvalidType.
The parameter action is the action taken when this error is raised(e.g., "decode").
func (*ErrInvalidType) Error ¶
func (e *ErrInvalidType) Error() string
Error returns the type of receiver and some additional message.
type ErrReceiverNil ¶
type ErrReceiverNil struct {
Type interface{}
}
ErrReceiverNil indicates the receiver is nil.
func NewErrReceiverNil ¶
func NewErrReceiverNil(rcvType interface{}) *ErrReceiverNil
NewErrReceiverNil creates a ErrReceiverNil.
func (*ErrReceiverNil) Error ¶
func (e *ErrReceiverNil) Error() string
Error returns the type of receiver.
type ErrTooShortToDecode ¶
type ErrTooShortToDecode struct { Type interface{} Message string }
ErrTooShortToDecode indicates the length of user input is too short to be decoded.
func NewErrTooShortToDecode ¶
func NewErrTooShortToDecode(decodedType interface{}, msg string) *ErrTooShortToDecode
NewErrTooShortToDecode creates a ErrTooShortToDecode.
func (*ErrTooShortToDecode) Error ¶
func (e *ErrTooShortToDecode) Error() string
Error returns the type of receiver of decoder method and some additional message.
type ErrUnsupported ¶
type ErrUnsupported struct { Type interface{} Message string }
ErrUnsupported indicates the value in Version field is invalid.
func NewErrUnsupported ¶
func NewErrUnsupported(unsupportedType interface{}, msg string) *ErrUnsupported
NewErrUnsupported creates a ErrUnsupported.
func (*ErrUnsupported) Error ¶
func (e *ErrUnsupported) Error() string
Error returns the type of receiver and some additional message.
type Frame ¶
Frame represents a program counter inside a stack frame.
This type is just an alias of Frame in pkg/errors library.
type StackTrace ¶
type StackTrace = errors.StackTrace
StackTrace is stack of Frames from innermost (newest) to outermost (oldest).
This type is just an alias of Frame in pkg/errors library.