Skip to main content

Abstract Class: AppKitError

Abstract Class: AppKitError

Base error class for all AppKit errors. Provides a consistent structure for error handling across the framework.

Example

// Catching errors by type
try {
  await lakebase.query("...");
} catch (e) {
  if (e instanceof AuthenticationError) {
    // Re-authenticate
  } else if (e instanceof ConnectionError && e.isRetryable) {
    // Retry with backoff
  }
}

// Logging errors
console.error(error.toJSON()); // Safe for logging, sensitive values redacted

Extends

  • Error

Extended by

Constructors

Constructor

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

Parameters

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

Returns

AppKitError

Overrides

Error.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 messagemessage 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.


cause?

readonly optional cause: Error;

Optional cause of the error

Overrides

Error.cause

code

abstract readonly code: string;

Error code for programmatic error handling


context?

readonly optional context: Record<string, unknown>;

Additional context for the error


isRetryable

abstract readonly isRetryable: boolean;

Whether this error type is generally safe to retry


statusCode

abstract readonly statusCode: number;

HTTP status code suggestion (can be overridden)

Accessors

clientMessage

Get Signature

get clientMessage(): string;

Sanitized message safe to forward to clients. Override in subclasses if a more specific default is appropriate.

Returns

string

Methods

toJSON()

toJSON(): Record<string, unknown>;

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

Returns

Record<string, unknown>


toString()

toString(): string;

Create a human-readable string representation

Returns

string

Databricks Developer Hub

Ready to ship your next agentic app in minutes?

Read docs