Skip to content

Move user error detection into custom error handler#1321

Merged
victorlin merged 2 commits intomasterfrom
victorlin/trim-logs
Feb 27, 2026
Merged

Move user error detection into custom error handler#1321
victorlin merged 2 commits intomasterfrom
victorlin/trim-logs

Conversation

@victorlin
Copy link
Member

@victorlin victorlin commented Feb 27, 2026

This PR contains 1 prep commit + 1 main commit. Message from main commit:

A better alternative to the previous implementation that avoids logging the error message again after the custom [verbose] message.

In the example below, the unnecessary 2nd log line is removed:

[verbose]       Sending NotFoundError: Not Found error as HTML with custom error handler
NotFoundError: Not Found

(follow-up to #1320 and old TODO)

Checklist

Existing behavior from Express's custom error handler¹ is retained.
To be modified later.

¹ https://github.com/expressjs/express/blob/b4ab7d65d7724d9309b6faaaf82ad492da2a6d35/lib/application.js#L153-L157
A better alternative to the previous implementation that avoids logging
the error message again after the custom [verbose] message.

In the example below, the unnecessary 2nd log line is removed:

    [verbose]       Sending NotFoundError: Not Found error as HTML with custom error handler
    NotFoundError: Not Found
@victorlin victorlin self-assigned this Feb 27, 2026
@victorlin victorlin merged commit 17542a4 into master Feb 27, 2026
10 checks passed
@victorlin victorlin deleted the victorlin/trim-logs branch February 27, 2026 19:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant