Overview
Factify uses conventional HTTP status codes and returns structured error responses.Error Response Format
All errors follow a consistent JSON structure:| Field | Type | Description |
|---|---|---|
type | string | Error category for broad handling |
code | string | Specific error for programmatic handling |
message | string | Human-readable explanation |
param | string | null | Field that caused the error |
Error Types
| Type | HTTP Status | When |
|---|---|---|
invalid_request_error | 400 | Validation failed, malformed request |
authentication_error | 401 | Missing or invalid API key |
authorization_error | 403 | Valid key, insufficient permissions |
not_found_error | 404 | Resource doesn’t exist |
rate_limit_error | 429 | Too many requests |
api_error | 500+ | Server-side failure |
SDK Error Classes
FactifyError is the base class for all HTTP error responses:
| Property | Type | Description |
|---|---|---|
error.message | string | Error message |
error.httpMeta.response | Response | HTTP response with headers |
error.httpMeta.request | Request | HTTP request details |
error.data$ | varies | Structured error data |
Handling Errors
Network Errors
The SDK provides specific error classes for network issues:| Error Class | Description |
|---|---|
ConnectionError | Unable to connect to server |
RequestTimeoutError | Request timed out |
RequestAbortedError | Request was aborted |
InvalidRequestError | Invalid request input |
ResponseValidationError | Response doesn’t match expected schema |
Error Codes Reference
- Validation Errors
- Authentication Errors
- Other Errors
| Code | Description |
|---|---|
missing_required_field | Required field not provided |
invalid_field_value | Field value fails validation |
invalid_enum_value | Value not in allowed set |
invalid_file_type | Uploaded file not PDF |
file_too_large | File exceeds size limit |
invalid_page_token | Pagination token invalid |