"""
Exceptions for the USDA FDC client.
"""
[docs]class FdcApiError(Exception):
"""Base exception for all FDC API errors."""
pass
[docs]class FdcAuthError(FdcApiError):
"""Exception raised when authentication fails."""
pass
[docs]class FdcRateLimitError(FdcApiError):
"""Exception raised when the API rate limit is exceeded."""
pass
[docs]class FdcTimeoutError(FdcApiError):
"""Exception raised when a request to the FDC API times out.
Distinct from a generic FdcApiError so callers can tell "slow" from
"broken" — a timeout is usually worth retrying, a 400 is not.
"""
pass
[docs]class FdcValidationError(FdcApiError):
"""Exception raised when input validation fails."""
pass
[docs]class FdcResourceNotFoundError(FdcApiError):
"""Exception raised when a requested resource is not found."""
pass