Skip to main content
⚠️ AppKit is in an early development phase and is subject to change without notice. DO NOT use in production environments.

# Class: ExecutionError

Error thrown when an operation execution fails. Use for statement failures, canceled operations, or unexpected states.

## Example​

    throw new ExecutionError("Statement failed: syntax error");
    throw new ExecutionError("Statement was canceled");

## Extends​

- `AppKitError`

## Constructors​

### Constructor​

    new ExecutionError(message: string, options?: {
      cause?: Error;
      context?: Record<string, unknown>;
    }): ExecutionError;

#### Parameters​

Parameter | Type
--- | ---
`message` | `string`
`options?` | { `cause?`: `Error`; `context?`: `Record`<`string`, `unknown`>; }
`options.cause?` | `Error`
`options.context?` | `Record`<`string`, `unknown`>

#### Returns​

`ExecutionError`

#### Inherited from​

`AppKitError`.`constructor`

## Properties​

### cause?​

    readonly optional cause: Error;

Optional cause of the error

#### Inherited from​

`AppKitError`.`cause`

### code​

    readonly code: "EXECUTION_ERROR" = "EXECUTION_ERROR";

Error code for programmatic error handling

#### Overrides​

`AppKitError`.`code`

### context?​

    readonly optional context: Record<string, unknown>;

Additional context for the error

#### Inherited from​

`AppKitError`.`context`

### isRetryable​

    readonly isRetryable: false = false;

Whether this error type is generally safe to retry

#### Overrides​

`AppKitError`.`isRetryable`

### statusCode​

    readonly statusCode: 500 = 500;

HTTP status code suggestion (can be overridden)

#### Overrides​

`AppKitError`.`statusCode`

## Methods​

### toJSON()​

    toJSON(): Record<string, unknown>;

Convert error to JSON for logging/serialization. Sensitive values in context are automatically redacted.

#### Returns​

`Record`<`string`, `unknown`>

#### Inherited from​

`AppKitError`.`toJSON`

### toString()​

    toString(): string;

Create a human-readable string representation

#### Returns​

`string`

#### Inherited from​

`AppKitError`.`toString`

### canceled()​

    static canceled(): ExecutionError;

Create an execution error for canceled operation

#### Returns​

`ExecutionError`

### missingData()​

    static missingData(dataType: string): ExecutionError;

Create an execution error for missing data

#### Parameters​

Parameter | Type
--- | ---
`dataType` | `string`

#### Returns​

`ExecutionError`

### resultsClosed()​

    static resultsClosed(): ExecutionError;

Create an execution error for closed/expired results

#### Returns​

`ExecutionError`

### statementFailed()​

    static statementFailed(errorMessage?: string): ExecutionError;

Create an execution error for statement failure

#### Parameters​

Parameter | Type
--- | ---
`errorMessage?` | `string`

#### Returns​

`ExecutionError`

### unknownState()​

    static unknownState(state: string): ExecutionError;

Create an execution error for unknown state

#### Parameters​

Parameter | Type
--- | ---
`state` | `string`

#### Returns​

`ExecutionError`