koajs / joi-router

Configurable, input and output validated routing for koa
MIT License
450 stars 96 forks source link

Allow throwing an error inside route handler when `continueOnError` is true #107

Closed mdpx closed 3 years ago

mdpx commented 4 years ago

Hi! came from #97 , created a sandbox that reproduces the problem -> sandbox. note the difference between sending a request with correct type but invalid body and a request with wrong type.

it happens when you use a centralized error handling middleware and you throw a proper error in route handlers when ctx.invalid is set.

I think it should be supported and work like a charm so I did some brain work and came up with a solution, will open a pr for this.