Skip to content

custom error handler cannot call next() #181

@eco747

Description

@eco747

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 );
    }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions