Published On Aug. 17th 2017

What's New in Laravel 5.5: Cleaner Exception Rendering

Episode 18 Run Time 5:03

Download

When an exception is thrown in your app, you can optionally let it bubble up to app/Exceptions/Handler.php. Here, you may type-check the exception to determine the appropriate response to return. While this is certainly useful, over the lifetime of a project, you'll notice that this method grows and grows.

A more object-oriented approach would be to allow the exception to determine how to render itself. And now, in Laravel 5.5, you can do that very thing.