How to make Laravel’s Exception Handler even better

You might know that Laravel 5.5 will be using Whoops out of the box as its default Exception Handler. And what you may not know is that Whoops supports many editors. If you make a typo or raise an Exception, Whoops will give you the full path to the file that caused that error. If you click that path, it will open automatically in the editor of your choice. Not out of the box though.

Inside your \App\Exceptions\Handler, add the following snippet:

What it does, it overrides the whoopsHandler() method from the base class adding just one line of code (line 21), which causes the link to open in Sublime Text. If you want other editor, many more are supported. The full list is available here.


If you want, say hi or follow me on Twitter @CzajkowskiDarek. Or visit my website at dczajkowski.com.

Thanks y’all, and have a wonderful day! ☀️