db/fact_store_errors.ts

Typed errors thrown by PgFactStore.put_stream so a file-store route can map them to the canonical wire responses.

The Rust twin uses FactError::PayloadTooLarge / ::StorageFull (fuz_fact); these TS classes carry the same two cases so the upload handler can branch identically and return the same status + body shape (413 / 507).

view source

Declarations
#

3 declarations

is_enospc_error
#

db/fact_store_errors.ts view source

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

Whether a thrown value is a Node filesystem ENOSPC (no space left on device). Used by the streaming disk write to translate the raw FS error into a StorageFullError.

err

type unknown

returns

boolean

PayloadTooLargeError
#

db/fact_store_errors.ts view source

import {PayloadTooLargeError} from '@fuzdev/fuz_app/db/fact_store_errors.js';

The streamed upload exceeded the byte cap. Thrown by put_stream when its mid-stream counter passes max_bytes — the backstop for a chunked or mis-declared Content-Length that the cheap header pre-check can't catch. A consumer route maps this to 413.

inheritance

extends: Error

bytes_read

Bytes read before the cap tripped (may exceed max_bytes by one chunk).

type number

readonly

max_bytes

type number

readonly

constructor

type new (bytes_read: number, max_bytes: number): PayloadTooLargeError

bytes_read

type number

max_bytes

type number

StorageFullError
#

db/fact_store_errors.ts view source

import {StorageFullError} from '@fuzdev/fuz_app/db/fact_store_errors.js';

The disk filled mid-stream (ENOSPC). Thrown by put_stream when the temp-file write fails for lack of space — the real disk-full guarantee that a best-effort free-space preflight can't promise (chunked uploads, TOCTOU races). A consumer route maps this to 507.

inheritance

extends: Error

constructor

type new (cause?: unknown): StorageFullError

cause?

type unknown
optional

Imported by
#