# Abstract Class: AppKitError

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

## Example[​](#example "Direct link to Example")

```typescript
// 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[​](#extends "Direct link to Extends")

* `Error`

## Extended by[​](#extended-by "Direct link to Extended by")

* [`AuthenticationError`](/appkit/docs/api/appkit/Class.AuthenticationError.md)
* [`ConfigurationError`](/appkit/docs/api/appkit/Class.ConfigurationError.md)
* [`ConnectionError`](/appkit/docs/api/appkit/Class.ConnectionError.md)
* [`ExecutionError`](/appkit/docs/api/appkit/Class.ExecutionError.md)
* [`InitializationError`](/appkit/docs/api/appkit/Class.InitializationError.md)
* [`ServerError`](/appkit/docs/api/appkit/Class.ServerError.md)
* [`TunnelError`](/appkit/docs/api/appkit/Class.TunnelError.md)
* [`ValidationError`](/appkit/docs/api/appkit/Class.ValidationError.md)

## Constructors[​](#constructors "Direct link to Constructors")

### Constructor[​](#constructor "Direct link to Constructor")

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

```

#### Parameters[​](#parameters "Direct link to Parameters")

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

#### Returns[​](#returns "Direct link to Returns")

`AppKitError`

#### Overrides[​](#overrides "Direct link to Overrides")

```ts
Error.constructor

```

## Properties[​](#properties "Direct link to Properties")

### cause?[​](#cause "Direct link to cause?")

```ts
readonly optional cause: Error;

```

Optional cause of the error

#### Overrides[​](#overrides-1 "Direct link to Overrides")

```ts
Error.cause

```

***

### code[​](#code "Direct link to code")

```ts
abstract readonly code: string;

```

Error code for programmatic error handling

***

### context?[​](#context "Direct link to context?")

```ts
readonly optional context: Record<string, unknown>;

```

Additional context for the error

***

### isRetryable[​](#isretryable "Direct link to isRetryable")

```ts
abstract readonly isRetryable: boolean;

```

Whether this error type is generally safe to retry

***

### statusCode[​](#statuscode "Direct link to statusCode")

```ts
abstract readonly statusCode: number;

```

HTTP status code suggestion (can be overridden)

## Methods[​](#methods "Direct link to Methods")

### toJSON()[​](#tojson "Direct link to toJSON()")

```ts
toJSON(): Record<string, unknown>;

```

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

#### Returns[​](#returns-1 "Direct link to Returns")

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

***

### toString()[​](#tostring "Direct link to toString()")

```ts
toString(): string;

```

Create a human-readable string representation

#### Returns[​](#returns-2 "Direct link to Returns")

`string`
