Documentation ¶
Overview ¶
Package internal provides some internal utilities.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func HTTPStatus ¶
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 ¶
StatusErrorDiff returns the empty string if the expected error string and status match err. Otherwise, it returns a description of the mismatch.
Types ¶
type CompositeError ¶
type CompositeError string
CompositeError represents an HTTP status, encoded in the first byte as the status - 400, plus the error message.
func (CompositeError) Error ¶
func (c CompositeError) Error() string
func (CompositeError) HTTPStatus ¶
func (c CompositeError) HTTPStatus() int
HTTPStatus returns c's HTTP status code.
type Error ¶
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 }
Error represents an error returned by Kivik.
This type definition is not guaranteed to remain stable, or even exported. When examining errors programatically, you should rely instead on the HTTPStatus() function in this package, rather than on directly observing the fields of this type.
func (*Error) HTTPStatus ¶
HTTPStatus returns the HTTP status code associated with the error, or 500 (internal server error), if none.
Directories ¶
Path | Synopsis |
---|---|
Package mock provides minimal mocks for kivik driver interfaces.
|
Package mock provides minimal mocks for kivik driver interfaces. |
Package nettest wraps [httptest.NewServer] to skip when called from GopherJS.
|
Package nettest wraps [httptest.NewServer] to skip when called from GopherJS. |
Package registry handles driver registrations.
|
Package registry handles driver registrations. |