Every failure thrown by the SDK is an instance of PoliPage\PoliPageException with an errorCode. SDK-internal codes are lowercase; codes from the API are uppercase. Specialized subclasses under PoliPage\Exception\* narrow by HTTP status.
| Code | When |
invalid_options | Constructor arguments are missing or malformed. |
network_error | TCP/TLS-level failure reaching the API. Retryable. |
timeout | The request did not complete within `timeout`. Retryable. |
aborted | Caller-driven cancellation. Not retryable. |
unknown_error | A catch-all for unexpected failures. |
DOWNLOAD_FAILED | The presigned PDF URL returned a non-2xx response. |
INTERNAL_ERROR | The API or SDK reached an unexpected state. |
| Code | When |
MISSING_API_KEY | No API key in the request. |
INVALID_API_KEY | The API key is malformed or revoked. |
| Code | When |
PAYMENT_REQUIRED | Organization billing is past due. |
FORBIDDEN | The key does not have access to the requested resource. |
ORGANIZATION_CANCELLED | The organization has been cancelled. |
ORGANIZATION_PURGED | The organization has been purged. |
| Code | When |
NOT_FOUND | The project/template slug does not exist or is not published. |
VERSION_NOT_FOUND | The pinned version does not exist for this template. |
DOCUMENT_NOT_FOUND | No stored document matches the supplied id. |
GONE | The resource existed but has been deleted. |
| Code | When |
VALIDATION_ERROR | `data` does not satisfy the template schema. |
MISSING_DATA | Request body lacks the required `data` field. |
MISSING_PROJECT_OR_TEMPLATE | Project mode call without both `project` and `template`. |
MISSING_TEMPLATE_SLUG | Template slug is missing. |
PROJECT_REQUIRED_FOR_DOCUMENT | Document-producing call missing `project`. |
INVALID_VERSION_FORMAT | The `version` string is not a valid semver. |
VERSION_REQUIRED | Live keys require a pinned `version`. |
INVALID_VERSION_FOR_KEY_ENV | Sandbox key targeting a live-only version, or vice versa. |
| Code | When |
QUOTA_EXCEEDED | Per-key rate limit or monthly quota reached. Retryable. |
OVERAGE_CAP_EXCEEDED | Hard overage cap reached. Not retryable. |
| Class | Extends | When |
|---|---|---|
| PoliPage\PoliPageException | RuntimeException | Base type for every SDK failure. |
| PoliPage\Exception\ApiStatusException | PoliPageException | Any non-2xx HTTP response. $status is non-null. |
| PoliPage\Exception\BadRequestException | ApiStatusException | HTTP 400. |
| PoliPage\Exception\AuthenticationException | ApiStatusException | HTTP 401. |
| PoliPage\Exception\PermissionDeniedException | ApiStatusException | HTTP 403. |
| PoliPage\Exception\NotFoundException | ApiStatusException | HTTP 404. |
| PoliPage\Exception\GoneException | ApiStatusException | HTTP 410. |
| PoliPage\Exception\RateLimitException | ApiStatusException | HTTP 429. |
| PoliPage\Exception\InternalServerException | ApiStatusException | HTTP 5xx. |
| PoliPage\Exception\ConnectionException | PoliPageException | Transport-layer failure (no HTTP response). |
| PoliPage\Exception\TimeoutException | ConnectionException | Per-request deadline exceeded. |