Skip to content

Errors

Every failure thrown by the SDK is a PoliPageException or a subclass. The base type exposes Code, StatusCode, Message, and RequestId. Compare Code against the PoliPageErrorCode constants for fine-grained branching when the subclass is too coarse.

Code When Recovery
PoliPageException Base class for all exceptions thrown by the Poli Page SDK. Catch this type to handle any SDK error; catch a derived type for specific error categories (auth, rate-limit, validation, etc.). HTTP any. Codes: *.
PoliPageAuthException Thrown when the API responds with HTTP 401 or 403. Indicates that the API key is missing, invalid, or lacks permission for the requested action. Check `PoliPage.PoliPageException.Code` to distinguish `PoliPage.PoliPageErrorCode.MissingApiKey`, `PoliPage.PoliPageErrorCode.InvalidApiKey`, and `PoliPage.PoliPageErrorCode.Forbidden`. HTTP 401 / 403. Codes: UNAUTHORIZED, FORBIDDEN.
PoliPageNotFoundException Thrown when the API responds with HTTP 404. Indicates that the requested resource (project, template, document, or version) does not exist. Check `PoliPage.PoliPageException.Code` for `PoliPage.PoliPageErrorCode.NotFound`, `PoliPage.PoliPageErrorCode.VersionNotFound`, or `PoliPage.PoliPageErrorCode.DocumentNotFound` to identify which resource was missing. HTTP 404. Codes: NOT_FOUND, VERSION_NOT_FOUND, DOCUMENT_NOT_FOUND.
PoliPageGoneException Thrown when the API responds with HTTP 410. Indicates that the requested resource previously existed but has been permanently removed. Unlike `PoliPage.PoliPageNotFoundException`, this is not retryable — the resource will not come back. HTTP 410. Codes: GONE.
PoliPageValidationException Thrown when the API responds with HTTP 400 or 422. Indicates that one or more request parameters failed server-side validation. Inspect `System.Exception.Message` for details on which fields are invalid. HTTP 400 / 422. Codes: VALIDATION.
PoliPageRateLimitException Thrown when the API responds with HTTP 429. Indicates that the caller has exceeded the allowed request rate. Wait for `PoliPage.PoliPageRateLimitException.RetryAfter` before making additional requests. HTTP 429. Codes: RATE_LIMIT.
PoliPagePaymentRequiredException Thrown when the API responds with HTTP 402. Indicates that the account has an outstanding balance that must be settled before further API calls are allowed. HTTP 402. Codes: PAYMENT_REQUIRED.
PoliPageNetworkException Thrown when a DNS resolution failure, TCP connection refusal, TLS handshake error, or transport-level timeout prevents the request from reaching the server. `PoliPage.PoliPageException.StatusCode` is always `0` because no HTTP response was received. Inspect `System.Exception.InnerException` for the underlying `System.Net.Http.HttpRequestException` or `System.Threading.Tasks.TaskCanceledException`. HTTP 0. Codes: NETWORK, TIMEOUT.
PoliPageDownloadException Thrown when a presigned URL download from remote storage (e.g. S3) fails. `PoliPage.PoliPageException.StatusCode` reflects the HTTP status returned by the storage service — it is distinct from the Poli Page API status code. HTTP storage. Codes: DOWNLOAD_FAILED.

These constants live on the static PoliPageErrorCode class. They are the exact strings returned by the API in the JSON error envelope’s code field.

using PoliPage;
catch (PoliPageException ex) when (ex.Code == PoliPageErrorCode.QuotaExceeded)
{
// bespoke handling.
}

| Constant | Value | |---|---| | Unauthorized | UNAUTHORIZED | | Forbidden | FORBIDDEN | | NotFound | NOT_FOUND | | VersionNotFound | VERSION_NOT_FOUND | | DocumentNotFound | DOCUMENT_NOT_FOUND | | Gone | GONE | | Validation | VALIDATION | | RateLimit | RATE_LIMIT | | Timeout | TIMEOUT | | Network | NETWORK | | DownloadFailed | DOWNLOAD_FAILED | | PaymentRequired | PAYMENT_REQUIRED | | OrganizationCancelled | ORGANIZATION_CANCELLED | | OrganizationPurged | ORGANIZATION_PURGED | | QuotaExceeded | QUOTA_EXCEEDED | | OverageCapExceeded | OVERAGE_CAP_EXCEEDED | | InvalidVersionFormat | INVALID_VERSION_FORMAT | | VersionRequired | VERSION_REQUIRED | | InvalidVersionForKeyEnv | INVALID_VERSION_FOR_KEY_ENV | | StorageRequired | STORAGE_REQUIRED | | Unknown | UNKNOWN |