db/db_checkout_error.ts

DbCheckoutError — a failed pool checkout, kept apart from a failed query.

A request that cannot check a connection out of the pool (the wait timed out, a new connection's connect timed out or was refused, the pool is closed) finds the database unavailable; every request surface answers it with a 503 (service_unavailable), where a query that fails on a connection already checked out keeps its 500. The pool built by create_pg_pool (db/db_pg.ts) throws one from its connect, which per-statement pool.query and each transaction's pool.connect() both run through. to_thrown_jsonrpc_error (http/jsonrpc_errors.ts) maps it, so the dispatcher, the route catch, and the server's onError all answer it the same way. Twin of the Rust spine's pool.get() failures, which answer fuz_http::db_unavailable / db_unavailable_response.

PGlite and pglet have no pool, so neither ever throws one.

view source

Declarations
#

2 declarations

DbCheckoutError
#

db/db_checkout_error.ts view source

import {DbCheckoutError} from '@fuzdev/fuz_app/db/db_checkout_error.js';

A pool checkout failed; cause carries the driver's error, and the message repeats it for the server's log (database checkout failed: <cause>). The wire never carries it — the answer is the fixed database unavailable.

inheritance

extends: Error

constructor

type new (options: ErrorOptions): DbCheckoutError

options

type ErrorOptions

is_db_checkout_error
#

db/db_checkout_error.ts view source

(err: unknown): boolean import {is_db_checkout_error} from '@fuzdev/fuz_app/db/db_checkout_error.js';

Whether err is a DbCheckoutError from any copy of fuz_app, recognized by its realm-global brand.

err

the thrown value

type unknown

returns

boolean

true for a failed pool checkout

Imported by
#