Skip to content

AIDK API Reference / aidk-shared / AIDKError

Class: AIDKError ​

Defined in: packages/shared/src/errors.ts:98

Base class for all AIDK errors. Provides consistent structure, serialization, and type identification.

Extends ​

  • Error

Extended by ​

Constructors ​

Constructor ​

ts
new AIDKError(
   code: AIDKErrorCode, 
   message: string, 
   details: Record<string, unknown>, 
   cause?: Error): AIDKError;

Defined in: packages/shared/src/errors.ts:105

Parameters ​

ParameterType
codeAIDKErrorCode
messagestring
detailsRecord<string, unknown>
cause?Error

Returns ​

AIDKError

Overrides ​

ts
Error.constructor

Properties ​

PropertyModifierTypeDescriptionDefined in
codereadonlyAIDKErrorCodeUnique error code for programmatic handlingpackages/shared/src/errors.ts:100
detailsreadonlyRecord<string, unknown>Additional error detailspackages/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 ​

ParameterType
jsonSerializedAIDKError

Returns ​

AIDKError


toJSON() ​

ts
toJSON(): SerializedAIDKError;

Defined in: packages/shared/src/errors.ts:131

Serialize error for transport (JSON-safe)

Returns ​

SerializedAIDKError

Released under the MIT License.