Documentation
¶
Overview ¶
Package errors provides convenience functions for Kivik drivers to report meaningful errors.
Index ¶
- func Cause(err error) error
- func Errorf(format string, args ...interface{}) error
- func New(msg string) error
- func Reason(err error) string
- func Status(status int, msg string) error
- func StatusCode(err error) int
- func Statusf(status int, format string, args ...interface{}) error
- func Wrap(err error, msg string) error
- func WrapStatus(status int, err error) error
- func Wrapf(err error, format string, args ...interface{}) error
- type Reasoner
- type StatusCoder
- type StatusError
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func StatusCode ¶
StatusCode extracts an embedded HTTP status code from an error.
func WrapStatus ¶
WrapStatus bundles an existing error with a status code.
Types ¶
type Reasoner ¶
type Reasoner interface {
Reason() string
}
Reasoner is an interface for an error that contains a reason.
type StatusCoder ¶
type StatusCoder interface {
StatusCode() int
}
StatusCoder is an optional error interface, which returns the error's embedded HTTP status code.
type StatusError ¶
type StatusError struct {
// contains filtered or unexported fields
}
StatusError is an error message bundled with an HTTP status code.
func (*StatusError) Error ¶
func (se *StatusError) Error() string
func (*StatusError) MarshalJSON ¶ added in v1.0.5
func (se *StatusError) MarshalJSON() ([]byte, error)
MarshalJSON satisifies the json.Marshaler interface for the StatusError type.
func (*StatusError) Reason ¶
func (se *StatusError) Reason() string
Reason returns the error's underlying reason.
func (*StatusError) StatusCode ¶
func (se *StatusError) StatusCode() int
StatusCode returns the StatusError's embedded HTTP status code.
Click to show internal directories.
Click to hide internal directories.