From e06ec2d0478bd45aca1d138aaa3b8e5e5b567cfe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gerg=C5=91=20M=C3=B3ricz?= Date: Mon, 23 Jun 2025 15:26:15 +0200 Subject: [PATCH] fix(api): improve error logging with structured error object (#1697) --- apps/api/src/index.ts | 15 ++------------- 1 file changed, 2 insertions(+), 13 deletions(-) diff --git a/apps/api/src/index.ts b/apps/api/src/index.ts index 7e79a49a..57cb836e 100644 --- a/apps/api/src/index.ts +++ b/apps/api/src/index.ts @@ -235,25 +235,14 @@ app.use( } const id = res.sentry ?? uuidv4(); - let verbose = JSON.stringify(err); - if (verbose === "{}") { - if (err instanceof Error) { - verbose = JSON.stringify({ - message: err.message, - name: err.name, - stack: err.stack, - }); - } - } logger.error( "Error occurred in request! (" + req.path + ") -- ID " + id + - " -- " + - verbose, - ); + " -- ", + { error: err }); res.status(500).json({ success: false, error: