Skip to main content

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;
context?: Record<string, unknown>;
}): AppKitError;

Parameters

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

Returns

AppKitError

Overrides

Error.constructor

Properties

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)

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