If you’re like me, you’d prefer your errors to be easily readable during debugging. Usually when you have an Ajax request fail, you get a large amount of HTML representing the error. This may be hard to parse through from inside your browser’s network tools pane. Luckily, Whoops provides a pretty easy solution for Laravel developers.

First off, we’re going to open app\Exceptions\Handler.php in your editor of choice and locate the render() method which will look like the example below in Laravel 5.2.

We’re going to do a slight change by adding a conditional that first verifies that our…

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store