/** * D1 / SQLite error taxonomy — used to write greppable log lines without * changing the fail-open / fail-closed semantics of each store method. * * } catch (e) { * const kind = classifyDbError(e); * console.log(`[LeadStore] method=optIn kind=${kind} msg=${(e as Error).message}`); * if (kind === 'schema' && (e as Error).stack) console.log((e as Error).stack); * return false; // keep whatever fallback semantics you had * } * * The `schema` bucket is the one worth screaming about — those are real * migration-drift bugs that would otherwise silently degrade the experience. * `transient` is expected occasionally under load; `unknown` is either a new * failure mode or something the taxonomy doesn't cover yet. * * Extracted from bibliafala's `src/lead.js:classifyDbError`. */ export type DbErrorKind = 'schema' | 'transient' | 'unknown'; /** Classify a D1 / SQLite error message into a coarse taxonomy. Never throws. */ export declare function classifyDbError(e: unknown): DbErrorKind; /** * Convenience one-liner: classify + emit a `[Scope] method=X kind=Y msg=Z` * log line. Also dumps the stack when `kind === 'schema'` because those are * bugs, not blips. * * logDbError('LeadStore', 'optIn', err); */ export declare function logDbError(scope: string, method: string, e: unknown): DbErrorKind; //# sourceMappingURL=db_error.d.ts.map