How to set custom exception handler in Laravel 5?
<p>Hi I'm new to laravel and working with custom exception handling. </p>

<p>I have caught all exceptions known to my knowledge and it is working fine. As per my understanding, <code>set_exception_handler</code> is used for handling uncaught exceptions. Now I have two questions:</p>

<p>1) I have to know whether my understanding for <code>set_exception_handler</code> is correct or not.</p>

<p>2) How to implement it in laravel 5 to handle uncaught exceptions</p>

<p>This is how I have implemented <code>set_exception_handler</code> in my controller</p>

<pre><code>class SearchController extends BaseController{

    public function getTitleMessage($exc){
        var_dump("set exception handler".$exc);
        return json_encode("Error");
    }

    public function genericSearch(){
       //Bussiness logic goes here

        set_exception_handler('getTitleMessage');
        throw new Exception("Search Failed");
    }
</code></pre>

<p>This is showing an error that <code>set_exception_handler</code> is not a valid callback. So I have changed my code to </p>

<pre><code>set_exception_handler(array($this,'getTitleMessage'));
</code></pre>

<p>But also not working for me. Someone guide me how to implement it in laravel controller. Thanks in advance</p>