Error per route
Hello everyone, this is a very basic question but I couldn't find any help online.
I was just wondering if it was possible to have any error handling callback per route.
For example with this code, how would you handle this error only for this route ?
I know I can use .onError but that would be global right ?
Any help is very much appricated 🙌
5 Replies
In middleware you can check
c.error
after await next()
but wouldn't this be global ? Since it's a middleware
no
.get('/idk', errorHandler, c => {...
nice thank you very much this is making more sense. Out of interest do you know why this cb has to be definied before the actual handler ?
Because that's the order they're called in