Skip to main content
You can handle errors gracefully using the SDK’s structured error classes. All errors extend the base WebacyError class, making it easy to catch and respond to different failure scenarios.

Error Classes

Basic Error Handling


Error Properties

All SDK errors include these properties:

Recovery Suggestions

Errors provide recovery suggestions:

Specific Error Types

AuthenticationError

Thrown when the API key is invalid or missing.

ValidationError

Thrown when input parameters are invalid.

RateLimitError

Thrown when you exceed API rate limits. The SDK automatically retries rate-limited requests with exponential backoff.

NotFoundError

Thrown when the requested resource doesn’t exist.

NetworkError

Thrown when there are network connectivity issues.

Retryable Errors

Check if an error can be retried:
Retryable errors:
  • RateLimitError - Wait and retry
  • NetworkError - Retry after connectivity restored
Non-retryable errors:
  • AuthenticationError - Fix API key
  • ValidationError - Fix input
  • NotFoundError - Resource doesn’t exist

Automatic Retries

The SDK automatically retries failed requests with exponential backoff:
Disable retries for specific requests using an AbortController:

Logging Errors

Convert errors to JSON for logging:

Full Example