Skip to main content

GraphyApiError

All API errors are wrapped in GraphyApiError. Each error carries structured metadata you can use to decide how to handle the failure:
Use the isGraphyApiError() type guard to safely narrow unknown errors. See the Type Reference for the full class definition.

Retry Behavior

The SDK automatically retries failed requests based on retryConfig. Default configuration:
Retry delay formula:
With defaults:

Retryable Conditions

Custom Retry Configuration

Disable Retries


Error Codes

Errors from the API include a code field:

Network Errors

Network failures throw a GraphyApiError with retryable: true:

Abort Errors

User cancellation throws a native AbortError:

Stream Errors

In streaming mode, errors can arrive as events:
Or as exceptions when the stream fails:

Timeout Errors

The SDK throws AbortError when a request exceeds the configured timeout:

Best Practices

Log errors with context

Show user-friendly messages