fix(api): improve error logging with structured error object (#1697)

This commit is contained in:
Gergő Móricz 2025-06-23 15:26:15 +02:00 committed by GitHub
parent 7ed19c0ac0
commit e06ec2d047
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -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: