Documentation
¶
Index ¶
- Variables
- func NewErrCustom(rsp *http.Response, err error) error
- func NewErrStatusCode(rsp *http.Response) error
- func NewErrUnknownContentType(rsp *http.Response) error
- func NewErrUnknownStatusCode(rsp *http.Response) error
- func WrapDecodingError(rsp *http.Response, err error) error
- type DecodingError
- type Error
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // ErrUnknownStatusCode is returned when the response status code is not known, // i.e. it has not been defined in the OpenAPI specification. ErrUnknownStatusCode = errors.New("unknown status code") // ErrUnknownContentType is returned when the response content type is not known, // i.e. it has not been defined in the OpenAPI specification // for the status code of the response. ErrUnknownContentType = errors.New("unknown content type") // ErrStatusCode is returned when the status code indicates an error. ErrStatusCode = errors.New("status code indicates an error") )
Functions ¶
func NewErrCustom ¶
NewErrCustom wraps a custom error in an api.Error. Use this if the status code is unsuccessful and the API returns more information, e.g. as part of a JSON that can be parsed and transformed into an error.
func NewErrStatusCode ¶
func NewErrUnknownStatusCode ¶
Types ¶
type DecodingError ¶
type DecodingError struct{ Err error }
DecodingError is an error returned when decoding the response body failed.
func (*DecodingError) Unwrap ¶
func (e *DecodingError) Unwrap() error
Unwrap returns the underlying error, e.g. a json.SemanticError.
type Error ¶
type Error struct { // The HTTP response. Response *http.Response // The underlying error. Err error // Indicates that this is a custom error returned by the API. IsCustom bool }
Error is an error returned by the API client. Use errors.As to check if the underlying error is of a specific type.
func (Error) ContentType ¶
ContentType returns the HTTP content type.
func (Error) StatusCode ¶
StatusCode returns the HTTP status code of the response.
Click to show internal directories.
Click to hide internal directories.