apperrors

package
v1.0.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 6, 2026 License: MIT Imports: 1 Imported by: 0

Documentation

Overview

Package apperrors defines the typed error hierarchy returned by every package in this module. Callers use errors.As / errors.Is against these types rather than matching on string messages.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type APIError

type APIError struct {
	Message string
	Status  int
	Code    string
	Body    []byte
}

APIError indicates the API responded with a well-formed error payload outside the other, more specific categories.

func (*APIError) Error

func (e *APIError) Error() string

func (*APIError) Reason

func (e *APIError) Reason() Reason

type AuthenticationError

type AuthenticationError struct {
	Message string
	Cause   error
}

AuthenticationError indicates missing, invalid, or expired credentials, or a failed OAuth2 token exchange.

func (*AuthenticationError) Error

func (e *AuthenticationError) Error() string

func (*AuthenticationError) Reason

func (e *AuthenticationError) Reason() Reason

func (*AuthenticationError) Unwrap

func (e *AuthenticationError) Unwrap() error

type DurationMS

type DurationMS int64

DurationMS is a small named type to keep RetryAfter's unit unambiguous at call sites without importing time here (kept dependency-free).

type NetworkError

type NetworkError struct {
	Message string
	Cause   error
}

NetworkError indicates a transport-level failure (timeout, connection refused, TLS failure, etc.) after retries were exhausted.

func (*NetworkError) Error

func (e *NetworkError) Error() string

func (*NetworkError) Reason

func (e *NetworkError) Reason() Reason

func (*NetworkError) Unwrap

func (e *NetworkError) Unwrap() error

type RateLimitError

type RateLimitError struct {
	Message    string
	RetryAfter *DurationMS
}

RateLimitError indicates HTTP 429 or a Procurement API rate-limit rejection. RetryAfter is the server-provided backoff hint, if any.

func (*RateLimitError) Error

func (e *RateLimitError) Error() string

func (*RateLimitError) Reason

func (e *RateLimitError) Reason() Reason

type Reason

type Reason string

Reason is a stable, machine-matchable classification of a failure, independent of the human-readable message.

const (
	ReasonUnknown        Reason = "unknown"
	ReasonAuthentication Reason = "authentication_failed"
	ReasonValidation     Reason = "validation_failed"
	ReasonAPI            Reason = "api_error"
	ReasonRateLimit      Reason = "rate_limited"
	ReasonNetwork        Reason = "network_error"
	ReasonSOAPFault      Reason = "soap_fault"
)

type SOAPFaultError

type SOAPFaultError struct {
	Message     string
	FaultCode   string
	FaultString string
	Operation   string
}

SOAPFaultError wraps a parsed <soap:Fault> from the legacy SOAP API.

func (*SOAPFaultError) Error

func (e *SOAPFaultError) Error() string

func (*SOAPFaultError) Reason

func (e *SOAPFaultError) Reason() Reason

type ValidationError

type ValidationError struct {
	Message string
	Errors  []string
}

ValidationError indicates the request was rejected, locally or by the API, as malformed.

func (*ValidationError) Error

func (e *ValidationError) Error() string

func (*ValidationError) Reason

func (e *ValidationError) Reason() Reason

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL