Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

custom error handler cannot call next() #181

Open
eco747 opened this issue Feb 15, 2022 · 0 comments
Open

custom error handler cannot call next() #181

eco747 opened this issue Feb 15, 2022 · 0 comments

Comments

@eco747
Copy link

eco747 commented Feb 15, 2022

as stated in the onError documentation:

Caution: Use next() to bypass certain errors at your own risk!
You must be certain that the exception will be handled elsewhere or can be safely ignored.
Otherwise your response will never terminate!

It should be cool to set 'next' to the default onError in the call of the custom procedure.

ie instead of (in the polka ctor):

this.onError = opts.onError || onError; // catch-all handler

somethink like:

this.onError = onError;
if( opts.onError ) {
    this.onError = function( err, req, res, next ) {
         opts.onError( err, req, res, onError );
    }
}
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

No branches or pull requests

1 participant