mirror of
https://github.com/bitbaum/heidi.git
synced 2026-12-04 05:17:27 +01:00
Claude-Session: https://claude.ai/code/session_019MDtmvb6xi489TfZMg7n9T Co-authored-by: Claude <noreply@anthropic.com>
18 lines
631 B
TypeScript
18 lines
631 B
TypeScript
import { dbConfigured } from "../../db/index.ts";
|
|
import { run } from "../../db/run.ts";
|
|
import { newBudget, report } from "./sink.ts";
|
|
|
|
/** This process's write budget for the sink (`sink.ts`, "bounded three ways"). */
|
|
const budget = newBudget();
|
|
|
|
/**
|
|
* Report a server error from the app: the sink, bound to the pool.
|
|
*
|
|
* `route` is a route PATTERN (a file path or a literal), never a requested
|
|
* address. Does nothing without a database, and never throws.
|
|
*/
|
|
export async function reportServerError(route: string, error: unknown): Promise<void> {
|
|
if (!dbConfigured()) return;
|
|
await report(run, route, error, budget);
|
|
}
|