AIDK API Reference / aidk-shared / TransportError
Class: TransportError ​
Defined in: packages/shared/src/errors.ts:444
Error thrown for network/transport failures.
Example ​
typescript
throw new TransportError('timeout', 'Request timed out after 30000ms');
throw new TransportError('connection', 'SSE connection error');
throw new TransportError('response', 'No response body');Extends ​
Constructors ​
Constructor ​
ts
new TransportError(
transportCode: "timeout" | "connection" | "response" | "parse",
message: string,
options: {
method?: string;
statusCode?: number;
url?: string;
},
cause?: Error): TransportError;Defined in: packages/shared/src/errors.ts:451
Parameters ​
| Parameter | Type |
|---|---|
transportCode | "timeout" | "connection" | "response" | "parse" |
message | string |
options | { method?: string; statusCode?: number; url?: string; } |
options.method? | string |
options.statusCode? | number |
options.url? | string |
cause? | Error |
Returns ​
TransportError
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 |
statusCode? | readonly | number | HTTP status code if applicable | - | packages/shared/src/errors.ts:449 |
transportCode | readonly | "timeout" | "connection" | "response" | "parse" | Type of transport error | - | packages/shared/src/errors.ts:446 |
Methods ​
connection() ​
ts
static connection(
message: string,
url?: string,
cause?: Error): TransportError;Defined in: packages/shared/src/errors.ts:494
Create a connection error
Parameters ​
| Parameter | Type |
|---|---|
message | string |
url? | string |
cause? | Error |
Returns ​
TransportError
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 ​
http() ​
ts
static http(
statusCode: number,
url: string,
message?: string): TransportError;Defined in: packages/shared/src/errors.ts:501
Create an HTTP error (non-2xx response)
Parameters ​
| Parameter | Type |
|---|---|
statusCode | number |
url | string |
message? | string |
Returns ​
TransportError
timeout() ​
ts
static timeout(timeoutMs: number, url?: string): TransportError;Defined in: packages/shared/src/errors.ts:487
Create a timeout error
Parameters ​
| Parameter | Type |
|---|---|
timeoutMs | number |
url? | string |
Returns ​
TransportError
toJSON() ​
ts
toJSON(): SerializedAIDKError;Defined in: packages/shared/src/errors.ts:131
Serialize error for transport (JSON-safe)