Error Handling¶
All API errors raise AccordionQ2ApiError, importable from the top-level package. The exception carries the HTTP status code and the server's error message.
Basic Usage¶
from accordionq2 import AccordionQ2ApiError
try:
ch = client.channels.get_channel(alias="does.not.exist")
except AccordionQ2ApiError as e:
print(f"HTTP {e.status_code}: {e}")
Common Error Codes¶
| HTTP Status | Meaning | Typical Cause |
|---|---|---|
| 400 | Bad Request | Invalid parameters, or get_samples() called after reduced_set=True |
| 404 | Not Found | Channel, resource, or config file does not exist |
| 500 | Internal Server Error | Hardware manager encountered an error |
| Connection refused | — | WebApi host is unreachable |
Exception Attributes¶
| Attribute | Type | Description |
|---|---|---|
status_code |
int |
HTTP status code |
message |
str |
Error message from the server |
The client automatically extracts error messages from RFC 7807 ProblemDetails responses
(checking the message, detail, and title fields in that order), as well as plain-text
and JSON error bodies.