coleman-benjamin
coleman-benjamin

Reputation: 951

Laravel 5 handle all errors

Not sure how this is done in Laravel 5. In 4 you could add in App::error(function(Exception $exception, $code){} block to the routes.php file, and it would serve as a blanket exception handler. I get how it works in Laravel 5 where you add handling for individual exceptions and custom exceptions, which is great - but is there a sort of "Catch all" handling mechanism as well?

Upvotes: 1

Views: 3776

Answers (1)

Manan
Manan

Reputation: 999

You would probably need to have to customize the render() method of App\Exceptions\Handler, as stated here : http://laravel.com/docs/5.0/errors#handling-errors

You can edit the app/Exceptions/Handler.php to do the job :

public function render($request, Exception $e)
{
    //Your code here
    return view('error');
}

Upvotes: 3

Related Questions