Skip to content

Fix #6462: Log full error object instead of just stack in logerror#7094

Closed
NithikYekollu wants to merge 1 commit into
expressjs:masterfrom
NithikYekollu:devin/1773081784-fix-logerror-swallows-details
Closed

Fix #6462: Log full error object instead of just stack in logerror#7094
NithikYekollu wants to merge 1 commit into
expressjs:masterfrom
NithikYekollu:devin/1773081784-fix-logerror-swallows-details

Conversation

@NithikYekollu
Copy link
Copy Markdown

Summary

Changes logerror in lib/application.js to use console.error(err) instead of console.error(err.stack || err.toString()), so that error details like Error.cause and custom properties (e.g. Sequelize parent/original) are preserved in the console output.

Fixes #6462

Changes

  • lib/application.js: Changed line 617 from console.error(err.stack || err.toString()) to console.error(err) in the logerror function

Why

console.error(err) delegates to Node's built-in error inspection, which handles Error.cause, custom enumerable properties, and other details that err.stack alone discards.

The test environment guard (this.get('env') !== 'test') is unchanged.


Link to Devin Session: https://app.devin.ai/sessions/68fe83d5d3064681931d4a9d7cdd7238
Requested by: nithik (nithik@berkeley.edu) / @NithikYekollu

Change console.error(err.stack || err.toString()) to console.error(err)
so that error details like Error.cause and custom properties (e.g.
Sequelize parent/original) are preserved in the output.

Fixes expressjs#6462

Co-Authored-By: nithik <nithik@berkeley.edu>
@krzysdz
Copy link
Copy Markdown
Contributor

krzysdz commented Mar 9, 2026

Duplicate of #6464

@krzysdz krzysdz marked this as a duplicate of #6464 Mar 9, 2026
@krzysdz krzysdz closed this Mar 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

logError swallows error details (such as cause)

2 participants