Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func IsTemporary ¶
IsTemporary returns true if any error in the chain is a TemporaryError. This is just a shortcut to using the more verbose xerrors.Is call.
func NewMyError ¶
NewMyError wraps an existing error, giving it type MyError
func NewTemporary ¶
NewTemporary wraps an existing error, giving it type TemporaryError.
func WithStatusCode ¶
WithStatusCode wraps an existing error, giving it a status code.
Types ¶
type ErrStatusCode ¶
type ErrStatusCode struct {
// contains filtered or unexported fields
}
ErrStatusCode is an error that holds some kind of status code.
func (*ErrStatusCode) Is ¶
func (e *ErrStatusCode) Is(err error) bool
Is is true if err is of type ErrStatysCode.
func (*ErrStatusCode) StatusCode ¶
func (e *ErrStatusCode) StatusCode() int
StatusCode returns the status code associated with this error. If .As returns true that an error is an ErrStatusCode, then this method may be used on the result.
func (*ErrStatusCode) Unwrap ¶
func (e *ErrStatusCode) Unwrap() error
Unwrap returns the underlying error.
type MyError ¶
type MyError struct {
// contains filtered or unexported fields
}
MyError is an example of a custom error type that can be tested with .Is.
type TemporaryError ¶
type TemporaryError struct {
// contains filtered or unexported fields
}
A TemporaryError is an example of a custom error that can be tested with .Is.
func (*TemporaryError) Is ¶
func (e *TemporaryError) Is(err error) bool
Is returns true if err is of type NewTemporary.
func (*TemporaryError) Unwrap ¶
func (e *TemporaryError) Unwrap() error
Unwrap returns the underlying error.