Clean and Efficient Error Handling in NextJS #65250
Unanswered
developedbynick
asked this question in
App Router
Replies: 1 comment 1 reply
-
hello @developedbynick, I haven't used it lately but if you like writing your API in the style of express they support app router pages router and you can handle errors just like express |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hello There. I'm new to NextJS and coming from the MERN stack.
In express there's a global error handler, but there's also a package called express-async-handler that catches any errors in route handler and calls a global error handler with the necessary data.
With all this said, Is there any way to handle errors in an API route cleanly rather than doing try/catch?
Beta Was this translation helpful? Give feedback.
All reactions