fix(reports): fix churn query crash and improve error reporting (#51)
The /api/reports/clients endpoint was crashing with a 500 on every request because a raw JavaScript Date passed into a sql template literal in .having() cannot be serialized by postgres-js. The fix serializes it as an ISO string with an explicit ::timestamptz cast. Also adds reportsRouter.onError() and improves the frontend error message to surface which specific endpoint failed and why. Fixes #49 Co-Authored-By: Paperclip <noreply@paperclip.ing>
This commit was merged in pull request #51.
This commit is contained in:
committed by
GitHub
parent
639429d73d
commit
21c0a7b59c
@@ -16,6 +16,11 @@ import {
|
||||
|
||||
export const reportsRouter = new Hono();
|
||||
|
||||
reportsRouter.onError((err, c) => {
|
||||
console.error("[reports] unhandled error:", err);
|
||||
return c.json({ error: "Internal server error", message: err.message }, 500);
|
||||
});
|
||||
|
||||
// ─── Helpers ──────────────────────────────────────────────────────────────────
|
||||
|
||||
function parseDate(value: string | undefined, fallback: Date): Date {
|
||||
|
||||
Reference in New Issue
Block a user