Documentation
¶
Overview ¶
Package ogenerror provides utilities for extracting error details from ogen-generated client errors.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func IsStatus ¶
IsStatus returns true if the error is an ogen UnexpectedStatusCodeError with the given status code.
func StatusCode ¶
StatusCode extracts just the status code from an ogen error. Returns 0 if the error is not an ogen UnexpectedStatusCodeError.
Types ¶
type UnexpectedStatus ¶
UnexpectedStatus contains the status code and response body from an ogen UnexpectedStatusCodeError.
func Parse ¶
func Parse(err error) *UnexpectedStatus
Parse extracts status code and response body from an ogen error. Returns nil if the error is not an ogen UnexpectedStatusCodeError.
Usage:
resp, err := client.SomeMethod(ctx, req)
if err != nil {
if status := ogenerror.Parse(err); status != nil {
fmt.Printf("Status: %d, Body: %s\n", status.StatusCode, status.Body)
}
}
Click to show internal directories.
Click to hide internal directories.