Skip to main content

Class: ExecutionError

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

Constructors

Constructor

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

Parameters

ParameterType
messagestring
options?{ cause?: Error; clientMessage?: string; context?: Record<string, unknown>; errorCode?: string; }
options.cause?Error
options.clientMessage?string
options.context?Record<string, unknown>
options.errorCode?string

Returns

ExecutionError

Overrides

AppKitError.constructor

Properties

_clientMessage?

protected readonly optional _clientMessage: string;

Client-safe error message. When set, callers serializing the error to a client (SSE, HTTP body) MUST prefer clientMessage over message — message may contain raw upstream / SDK text including statement fragments, internal object names, and correlation IDs.

Subclasses can set this in their constructor for a fixed sanitized string. When unset, clientMessage defaults to a generic per-code string (see the getter), and the raw message is kept server-side only.

Inherited from

AppKitError._clientMessage


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


errorCode?

readonly optional errorCode: string;

Structured error code from the upstream source (typically the warehouse's error_code for statement-level failures, or the SDK's ApiError.errorCode for HTTP failures). Preserved through wrapping so callers can branch on a stable identifier without substring-matching the message.


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

Accessors

clientMessage

Get Signature

get clientMessage(): string;

Execution errors default to a generic message — the raw warehouse / SDK text in .message often includes statement fragments, internal paths, and correlation IDs. UI code should branch on errorCode (RESULT_TOO_LARGE_FOR_JSON_FALLBACK, NOT_IMPLEMENTED, etc.) and not on the human string.

Returns

string

Overrides

AppKitError.clientMessage

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

ParameterType
dataTypestring

Returns

ExecutionError


resultsClosed()

static resultsClosed(): ExecutionError;

Create an execution error for closed/expired results

Returns

ExecutionError


statementFailed()

static statementFailed(
   errorMessage?: string, 
   errorCode?: string, 
   clientMessage?: string): ExecutionError;

Create an execution error for statement failure.

Parameters

ParameterTypeDescription
errorMessage?stringHuman-readable error from the warehouse / SDK. Goes into .message for server logs only — never echoed to the client. Pass clientMessage explicitly if a sanitized text should reach the UI.
errorCode?stringStructured code (e.g. "INVALID_PARAMETER_VALUE") to preserve through wrapping. Optional. Forwarded on SSE error payloads so UI can branch on it instead of substring-matching error.
clientMessage?stringOptional client-safe replacement for .message. Defaults to "Query execution failed" via the clientMessage getter. Set this only when the upstream text is known-safe.

Returns

ExecutionError


unknownState()

static unknownState(state: string): ExecutionError;

Create an execution error for unknown state

Parameters

ParameterType
statestring

Returns

ExecutionError

Databricks Developer Hub

Ready to ship your next agentic app in minutes?

Read docs