PageRouterOnError: ((req, res, error) => Promise<void> | void)

Type declaration

    • (req, res, error): Promise<void> | void
    • Error handler for the default auth routes.

      Use this to define an error handler for all the default routes in a single place. For example:

      export default handleAuth({
      onError(req, res, error) {
      errorLogger(error);
      // You can finish the response yourself if you want to customize
      // the status code or redirect the user
      // res.writeHead(302, {
      // Location: '/custom-error-page'
      // });
      // res.end();
      }
      });

      Parameters

      Returns Promise<void> | void