Skip to main content

Throw NextJs Errors instead of generic within `or` clause

NextJs has great built in methods to handle things like notFound and soon to come the unauthorized function:

https://nextjs.org/docs/app/api-reference/functions/unauthorized

It would be great if the useUser or await getUser functions or parameter could allow for calling of these functions. Sometimes I would prefer to throw a not found if the user is unauthenticated and other times I would prefer to render an unauthorized UI

Log in to comment and vote

No comments yet

Be the first to share your thoughts.