OnError =AppOnError|PageOnError
Error handler invoked when an exception occurs during execution of the sign-in, callback, sign-out, or userinfo endpoints.
In the App Router, you must either return a NextResponseor throw an error. Otherwise, the request will remain unresolved.In the Pages Router, you must send a response (for example, res.send()orres.json()) after handling the error, or the request will hang.