Error Hierarchy
ComplianceError
Base class for all SDK errors.Properties
| Property | Type | Description |
|---|---|---|
message | string | Human-readable error message |
code | string | Error code |
cause | Error | undefined | Original error if wrapped |
Methods
| Method | Return Type | Description |
|---|---|---|
toJSON() | object | Serializable representation |
ValidationError
Thrown when input fails schema validation.Properties
| Property | Type | Description |
|---|---|---|
issues | ValidationIssue[] | Array of validation issues |
ValidationIssue
Example
APIError
Base class for API-related errors.Properties
| Property | Type | Description |
|---|---|---|
statusCode | number | HTTP status code |
requestId | string | undefined | Request ID for debugging |
Type Guard
NotFoundError
Thrown when a resource is not found (404).Properties
| Property | Type | Description |
|---|---|---|
resourceId | string | undefined | ID of the missing resource |
resourceType | string | undefined | Type of the missing resource |
Example
UnauthorizedError
Thrown when authentication fails (401).Example
ForbiddenError
Thrown when access is denied (403).Example
RateLimitError
Thrown when rate limit is exceeded (429).Properties
| Property | Type | Description |
|---|---|---|
retryAfter | number | Seconds to wait before retry |
Example
ServerError
Thrown for server errors (5xx).Example
NetworkError
Thrown for network failures.Example
TimeoutError
Thrown when request times out.Example
UploadError
Base class for upload-related errors.Properties
| Property | Type | Description |
|---|---|---|
stage | UploadStage | Stage where upload failed |
UploadStage
| Value | Description |
|---|---|
"request" | Failed to request the presigned upload URL |
"upload" | Failed to upload the file bytes to storage |
"confirm" | Failed to confirm the upload with the API |
Type Guard
FileTooLargeError
Thrown when file exceeds size limit.Properties
| Property | Type | Description |
|---|---|---|
maxSize | number | Maximum allowed size in bytes |
actualSize | number | Actual file size in bytes |
InvalidFileTypeError
Thrown for unsupported file types.Properties
| Property | Type | Description |
|---|---|---|
mimeType | string | Actual MIME type |
allowedTypes | string[] | Allowed MIME types |
