Skip to content

Documentation / @agentick/shared / AbortError

Class: AbortError

Defined in: errors.ts:193

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

new AbortError(message?, code?, details?, cause?): AbortError

Defined in: errors.ts:194

Parameters

message?

string = "Operation aborted"

code?

"ABORT_CANCELLED" | "ABORT_TIMEOUT" | "ABORT_SIGNAL"

details?

Record<string, unknown> = {}

cause?

Error

Returns

AbortError

Overrides

AgentickError.constructor

Properties

cause?

readonly optional cause: Error

Defined in: errors.ts:108

Original error that caused this error

Inherited from

AgentickError.cause


code

readonly code: AgentickErrorCode

Defined in: errors.ts:102

Unique error code for programmatic handling

Inherited from

AgentickError.code


details

readonly details: Record<string, unknown>

Defined in: errors.ts:105

Additional error details

Inherited from

AgentickError.details

Methods

fromJSON()

static fromJSON(json): AgentickError

Defined in: errors.ts:169

Create error from serialized format

Parameters

json

SerializedAgentickError

Returns

AgentickError

Inherited from

AgentickError.fromJSON


fromSignal()

static fromSignal(signal): AbortError

Defined in: errors.ts:207

Create from an AbortSignal's reason

Parameters

signal

AbortSignal

Returns

AbortError


timeout()

static timeout(timeoutMs): AbortError

Defined in: errors.ts:225

Create a timeout abort error

Parameters

timeoutMs

number

Returns

AbortError


toJSON()

toJSON(): SerializedAgentickError

Defined in: errors.ts:137

Serialize error for transport (JSON-safe)

Returns

SerializedAgentickError

Inherited from

AgentickError.toJSON

Released under the ISC License.