Errors
Exception hierarchy (all inherit from FoodAPIError): classDiagram Exception <|-- FoodAPIError FoodAPIError <|-- AuthenticationError FoodAPIError <|--…
PythonTypeScript
Exception hierarchy (all inherit from FoodAPIError):
classDiagram
Exception <|-- FoodAPIError
FoodAPIError <|-- AuthenticationError
FoodAPIError <|-- RateLimitError
FoodAPIError <|-- ValidationError
FoodAPIError <|-- NotFoundError
FoodAPIError <|-- ServerError
foodapi.exceptions.FoodAPIError
¶
FoodAPIError(
message: str,
*,
status_code: int | None = None,
request_id: str | None = None,
body: dict[str, Any] | None = None
)
Bases: Exception
Base error for all FoodAPI SDK failures.
foodapi.exceptions.AuthenticationError
¶
foodapi.exceptions.RateLimitError
¶
foodapi.exceptions.ValidationError
¶
foodapi.exceptions.NotFoundError
¶
foodapi.exceptions.ServerError
¶
Exception paths
| HTTP status | Exception | Attributes |
|---|---|---|
| 401, 403 | AuthenticationError |
status_code, request_id, body |
| 400, 422 | ValidationError |
body may contain field errors |
| 404 | NotFoundError |
|
| 429 | RateLimitError |
retry_after_seconds |
| 500–599 | ServerError |
retried per max_retries |
| Network / timeout | FoodAPIError |
no status_code |