feat: add Sentry error tracking with PII scrubbing

This commit is contained in:
ashim-hq
2026-04-22 19:10:28 +08:00
parent 544f81c48d
commit 9f66ad85bf
2 changed files with 62 additions and 0 deletions
+6
View File
@@ -73,6 +73,12 @@ app.setErrorHandler((error: Error & { statusCode?: number }, request, reply) =>
{ err: error, url: request.url, method: request.method },
"Unhandled request error",
);
try {
const Sentry = require("@sentry/node") as typeof import("@sentry/node");
Sentry.captureException(error);
} catch {
// Sentry not available
}
const isProduction = process.env.NODE_ENV === "production";
reply.status(statusCode).send({
error: statusCode >= 500 ? "Internal server error" : error.message,