class DatabaseUnavailableError
extends Error
Since 0.5.0

Thrown when the database, its connection pool, or its network is temporarily unreachable (X35-2, M90f). The operation did not happen and may be retried.

The condition reaches the client as 503 Service Unavailable — the load-shedding status — instead of a masked 500. No Retry-After is carried, and the hint channel cannot carry one: ErrorResponseInit has no header channel, and the framework holds no honest value to invent — a pool's saturation has no published horizon. 503 is itself the retryable signal (RFC 9110), and the rate limiter's Retry-After (which does know its reset point) is the deliberate asymmetry, recorded in PUBLIC_API.md.

Examples

Example 1

import { DatabaseUnavailableError } from '@setu-ts/database-plugin';
try {
  await repo.findAll(query);
} catch (err) {
  if (err instanceof DatabaseUnavailableError) {
    // Back off and retry: the pool or connection is saturated.
  }
}

Constructors

DatabaseUnavailableError(
message: string,
options?: { cause?: unknown; }
)

Creates the error. The message is the full diagnostic — safe to log, never to serve.

Parameters
message: string

The full diagnostic, safe to log

optional
options: { cause?: unknown; }

The original driver error, preserved as cause

Properties

readonly
name: string

Discriminant for consumers that cannot use instanceof across realms.

Usage

import { DatabaseUnavailableError } from "database-plugin/src/index.ts";