func HTTPStatus(err error) int
HTTPStatus returns the HTTP status code embedded in the error, or 500 (internal server error), if there was no specified status code. If err is nil, HTTPStatus returns 0.
func StatusErrorDiff(wantErr string, wantStatus int, err error) string
StatusErrorDiff returns the empty string if the expected error string and status match err. Otherwise, it returns a description of the mismatch.
func StatusErrorDiffRE(wantErrRE string, wantStatus int, err error) string
StatusErrorDiffRE returns the empty string if the expected error RE and status match err. Otherwise, it returns a description of the mismatch.
CompositeError represents an HTTP status, encoded in the first byte as the status - 400, plus the error message.
type CompositeError string
func (c CompositeError) Error() string
func (c CompositeError) HTTPStatus() int
HTTPStatus returns c's HTTP status code.
Error represents an error returned by Kivik.
This type definition is not guaranteed to remain stable, or even exported. When examining errors programmatically, you should rely instead on the HTTPStatus() function in this package, rather than on directly observing the fields of this type.
type Error struct { // Status is the HTTP status code associated with this error. Normally // this is the actual HTTP status returned by the server, but in some cases // it may be generated by Kivik directly. Status int // Message is the error message. Message string // Err is the originating error, if any. Err error }
func (e *Error) Error() string
func (e *Error) Format(f fmt.State, c rune)
Format implements fmt.Formatter.
func (e *Error) HTTPStatus() int
HTTPStatus returns the HTTP status code associated with the error, or 500 (internal server error), if none.
func (e *Error) Unwrap() error
Unwrap satisfies the errors wrapper interface.