AIDK API Reference / aidk-shared / AbortError
Class: AbortError ​
Defined in: packages/shared/src/errors.ts:187
Error thrown when an operation is aborted or cancelled.
Example ​
typescript
throw new AbortError('User cancelled the operation');
throw new AbortError('Operation timed out', 'ABORT_TIMEOUT', { timeoutMs: 30000 });Extends ​
Constructors ​
Constructor ​
ts
new AbortError(
message: string,
code: "ABORT_CANCELLED" | "ABORT_TIMEOUT" | "ABORT_SIGNAL",
details: Record<string, unknown>,
cause?: Error): AbortError;Defined in: packages/shared/src/errors.ts:188
Parameters ​
| Parameter | Type | Default value |
|---|---|---|
message | string | "Operation aborted" |
code | "ABORT_CANCELLED" | "ABORT_TIMEOUT" | "ABORT_SIGNAL" | "ABORT_CANCELLED" |
details | Record<string, unknown> | {} |
cause? | Error | undefined |
Returns ​
AbortError
Overrides ​
Properties ​
| Property | Modifier | Type | Description | Inherited from | Defined in |
|---|---|---|---|---|---|
code | readonly | AIDKErrorCode | Unique error code for programmatic handling | AIDKError.code | packages/shared/src/errors.ts:100 |
details | readonly | Record<string, unknown> | Additional error details | AIDKError.details | packages/shared/src/errors.ts:103 |
Methods ​
fromJSON() ​
ts
static fromJSON(json: SerializedAIDKError): AIDKError;Defined in: packages/shared/src/errors.ts:163
Create error from serialized format
Parameters ​
| Parameter | Type |
|---|---|
json | SerializedAIDKError |
Returns ​
Inherited from ​
fromSignal() ​
ts
static fromSignal(signal: AbortSignal): AbortError;Defined in: packages/shared/src/errors.ts:201
Create from an AbortSignal's reason
Parameters ​
| Parameter | Type |
|---|---|
signal | AbortSignal |
Returns ​
AbortError
timeout() ​
ts
static timeout(timeoutMs: number): AbortError;Defined in: packages/shared/src/errors.ts:219
Create a timeout abort error
Parameters ​
| Parameter | Type |
|---|---|
timeoutMs | number |
Returns ​
AbortError
toJSON() ​
ts
toJSON(): SerializedAIDKError;Defined in: packages/shared/src/errors.ts:131
Serialize error for transport (JSON-safe)