mirror of
https://github.com/alkimake/paperclip.git
synced 2026-06-15 18:30:39 +09:00
Fix 500 error logging to show actual error instead of generic message
pino-http checks res.err before falling back to its generic "failed with status code 500" error. Set res.err to the real error in the error handler so logs include the actual message and stack trace. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
185317c153
commit
690149d555
2 changed files with 8 additions and 7 deletions
|
|
@ -55,11 +55,7 @@ export const httpLogger = pinoHttp({
|
|||
customErrorMessage(req, res) {
|
||||
return `${req.method} ${req.url} ${res.statusCode}`;
|
||||
},
|
||||
customProps(_req, res) {
|
||||
const serverError = (res as any).locals?.serverError;
|
||||
if (serverError) {
|
||||
return { serverError };
|
||||
}
|
||||
customProps() {
|
||||
return {};
|
||||
},
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue