hapi automatically responds with JSON for any error passed to a route's
reply() method. But what if your application needs errors rendered in HTML? This lesson shows how to implement friendly HTML error messages using hapi extension events.
You've got a few options. If you only need a customized behavior for one or two routes, I'd opt to just add logic to the
onPreResponse event that checks for those routes and changes the behavior. As, your needs grow, you will likely want to move that logic into a hapi Plugin that will allow you to add the intended behavior to your route as configuration.