Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
Functions ¶
func IsAPIError ¶
IsAPIError checks if an error is an API error with a response body
func IsClientError ¶
IsClientError reports whether err is a client (4xx) error. This function now works with the new error hierarchy while maintaining backward compatibility.
func IsInfrastructureError ¶
IsInfrastructureError checks if error is a network infrastructure error
func IsInternalError ¶
IsInternalError checks if error is an internal library error
func IsServerError ¶
IsServerError reports whether err is a server (5xx) error. This function now works with the new error hierarchy while maintaining backward compatibility.
Types ¶
type APIError ¶
type APIError struct {
StatusCode int // HTTP status code
URL string // URL of the request
Body []byte // Raw error response body
}
APIError represents server responses with error status codes
func AsAPIError ¶
AsAPIError attempts to extract an APIError from an error chain
func (*APIError) ParseError ¶
ParseError attempts to parse the error body into the provided struct
type ErrorWithBody ¶
type ErrorWithBody interface {
RawBody() []byte // RawBody returns the raw error response body
ParseError(target any) error // ParseError attempts to parse the error body
}
ErrorWithBody provides access to raw error response bodies. ParseError expects target to be a pointer to a struct; it returns a json.Unmarshal error otherwise.
type InfrastructureError ¶
InfrastructureError represents network-level failures
func (*InfrastructureError) Error ¶
func (e *InfrastructureError) Error() string
func (*InfrastructureError) Unwrap ¶
func (e *InfrastructureError) Unwrap() error
type InternalError ¶
type InternalError struct {
Err error // Underlying error
Op string // Operation where error occurred
}
InternalError represents errors in request construction
func (*InternalError) Error ¶
func (e *InternalError) Error() string
func (*InternalError) Unwrap ¶
func (e *InternalError) Unwrap() error