Errors¶
Exception classes raised by the library.
GrocyError¶
Raised when the Grocy API returns an HTTP 4xx or 5xx response.
from grocy.errors import GrocyError
try:
product = grocy.product(99999)
except GrocyError as e:
print(f"HTTP {e.status_code}: {e.message}")
GrocyError(response)
¶
Bases: Exception
Exception raised when the Grocy API returns an error response.
Attributes:
| Name | Type | Description |
|---|---|---|
status_code |
int
|
HTTP status code from the response. |
message |
str
|
Error message from the API, if available. |