One structured exit for server errors
Shipped 2026-10-27
About 270 places in the API answered an unexpected failure with
res.status(500).json(error). Every 5xx body is replaced before it is sent by
res.finished (with Internal Server Error in production, the error’s stack
elsewhere), so the SQL in a database error never reached a client; the change
gives every one of these paths a single, structured exit instead.
They now call this.serverError(error) from BaseController (middleware:
sendServerError(res, error)), which logs http.server_error (error kind,
message, code and stack, plus the endpoint and method) and answers a generic
500. What the client sees is unchanged, because res.finished still replaces
the body.
res.finished still handles the 5xx (the TNBUGS ticket, the error email,
Sentry). It reads the error from res.locals.serverError: the first release of
this change sent it only the generic body, so for about an hour those paths
saw Internal Server Error with no cause (none occurred).
Admin tools that return their own validation messages (member delete, membership renewal) are unchanged.