How to handle notFound errors based on route param validation?
/posts/$postId where I essentially just call a server function to get the relevant post:With this setup zod throws a validation error when the postId param is not a valid UUID - which I want because then it doesn't actually have to unnecessarily query the database. However ideally I would want to throw an error using
notFound() instead in these cases so the correct not found error component is shown rather than the generic one.I assume I'm missing some logic about how to handle this in router and it shouldn't be getting to the point that the serverFn is actually called but I've struggled to find anything relevant in the docs - hoping I'm just being dumb?