Skip to content

Repair original enableExpressErrorHandler behaviour #7859

Open
@johanarnor

Description

@johanarnor

New Issue Checklist

Issue Description

This discussion started in #6423 (comment) so this is a standalone issue where we can discuss this in isolation (most text is just a copy from my original comment).

I stumbled upon PR #6423 since we're currently adopting Sentry error reporting for our backend. To use Sentry's errorHandler middleware we're required to set enableExpressErrorHandler to true. However, after PR #6423 was merged this also mean that the default Parse error handler is basically disabled.

I checked the history and found the PR that introduced this feature from the beginning (#4697). The original intention seems to have been quite different. Instead of replacing the default Parse error handler it just used next to let the error flow through subsequent middlewares, which would be optimal our use-case with Sentry.

So by merging this fix it also seems to have broken the intended behaviour. A way to solve this might be to introduce a "overrideParseErrorHandler" (naming suggestions greatly appreciated) config or similar, and restore the original behaviour.

A workaround is of course to copy the logic from the Parse error handler and use that as a middleware in our own application, but that's not optimal.

Metadata

Metadata

Assignees

No one assigned

    Labels

    type:featureNew feature or improvement of existing feature

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions