Next.js Discord

Discord Forum

Catch errors in middleware

Unanswered
Crucian carp posted this in #help-forum
Open in Discord
Avatar
Crucian carpOP
How do I catch errors in my middleware ?
Can I just add an error.tsx in my src directory?

2 Replies

Avatar
Crucian carpOP
Bump
Avatar
You mean catch errors that happen during the middleware? You would wrap them in try...catch