DedalusError class.
Error Hierarchy
Error Types
DedalusError
The base error class for all SDK errors.src/core/error.ts:5
APIError
Base class for HTTP response errors. Contains status code, headers, and error body.src/core/error.ts:7-24
status- HTTP status code (e.g., 400, 401, 500)headers- Response headerserror- Parsed JSON error bodymessage- Human-readable error message
Status-Specific Errors
BadRequestError (400)
src/core/error.ts:116
AuthenticationError (401)
src/core/error.ts:118
PermissionDeniedError (403)
src/core/error.ts:120
NotFoundError (404)
src/core/error.ts:122
ConflictError (409)
src/core/error.ts:124
UnprocessableEntityError (422)
src/core/error.ts:126
RateLimitError (429)
src/core/error.ts:128
InternalServerError (500+)
src/core/error.ts:130
Connection Errors
APIConnectionError
src/core/error.ts:101-108
cause property.
APIConnectionTimeoutError
src/core/error.ts:110-114
APIUserAbortError
src/core/error.ts:95-99
AbortSignal.
Response Parsing Errors
LengthFinishReasonError
src/lib/parser.ts:172-177
ContentFilterFinishReasonError
src/lib/parser.ts:182-187
Error Generation
The SDK automatically generates the appropriate error type based on HTTP status codes:src/core/error.ts:47-92
Error Handling Patterns
Basic Try-Catch
Type-Specific Handling
Accessing Error Details
Rate Limit Handling
Abort Handling
Parsing Error Handling
Accessing Error Classes
All error classes are available as static properties on theDedalus class:
src/client.ts:835-847