title: how to display exception handling error message in laravel
body: <p>I have <strong>homecontroller</strong> in which I have a function <strong>storestudent</strong> it should able to handle exception, how to do it?</p>
  
  <pre><code> public function storestudent(Request $request)
      {
        try
        {
  
  
          $student= new student();
          $student-&gt;sregno= $request['regno'];
  
              $student-&gt;save();
              return redirect('/home');
  
            } catch (Exception $e){
  
                  throw new Execution;
  
            }
       } 
  </code></pre>
  
  <p>try-catch exception is not working , help me to fix this please.
  Thank you.</p>
  
  <p>this is <strong>Execution.php</strong></p>
  
  <pre><code>&lt;?php
  
  namespace App\Exceptions;
  
  use Exception;
  
  class Execution extends Exception
  {
  
  //
  }
  </code></pre>
  
  <p>in <strong>handler.php</strong></p>
  
  <pre><code> public function report(Exception $exception)
  {
      if($exception instanceof Execution)
      {
          echo "invalid register no";
      }
      parent::report($exception);
  }
  </code></pre>
  
  <p>it gives me this error</p>
  
  <pre><code>This page isn’t working 127.0.0.1 is currently unable to handle this request.
  HTTP ERROR 500
  </code></pre>
  
  <p>anyone help me to display my message and it should redirect to same page.</p>