trpc: do not return query text or params in internal errors #116

Stängd
öppnade 2026-10-08 21:12:28 +00:00 av supernaut · 0 kommentarer
Ägare

What

Internal errors send the raw message to the caller.

Why

onError logs only the root message. The HTTP response still carries error.message.

Failing case

With the database down, subscriptionStatus returns Failed query: select ... params: alice-private,incomplete,1. For checkout the params include the billing name and email.

Fix

In errorFormatter in src/router.ts, for INTERNAL_SERVER_ERROR set message to internal error and drop data.stack. Keep data.reason for ReasonError. Test next to the log test in src/server.test.ts.

Done when

  • A DB failure response has no SQL and no param.
  • Reason codes still reach the caller.
## What Internal errors send the raw message to the caller. ## Why `onError` logs only the root message. The HTTP response still carries `error.message`. ## Failing case With the database down, `subscriptionStatus` returns `Failed query: select ... params: alice-private,incomplete,1`. For checkout the params include the billing name and email. ## Fix In `errorFormatter` in `src/router.ts`, for `INTERNAL_SERVER_ERROR` set `message` to `internal error` and drop `data.stack`. Keep `data.reason` for `ReasonError`. Test next to the log test in `src/server.test.ts`. ## Done when - [ ] A DB failure response has no SQL and no param. - [ ] Reason codes still reach the caller.
supernaut lade till detta till projektet Bitborg Payment 2026-10-08 21:14:08 +00:00
Logga in för att delta i denna konversation.
Ingen milstolpe
Inget projekt
Inga tilldelade
1 deltagare
Notiser
Förfallodatum
Förfallodatumet är ogiltigt eller utanför gränserna. Använd formatet "åååå-mm-dd".

Inget förfallodatum satt.

Beroenden

Inga beroenden satta

Referens
bitborg/bitborg-payment#116
Ingen beskrivning angiven.