title: Laravel returning HttpException object instead of showing custom error pages
body: <p>I'm using spatie permissions module for controlling roles and permissions within my site. I have added a bit to the Authenticate middleware. My Handle now looks like this:</p>
  
  <pre><code>public function handle($request, Closure $next, $guard = null)
  {
      if (Auth::guard($guard)-&gt;guest())
      {
          if ($request-&gt;ajax() || $request-&gt;wantsJson())
              return response('Unauthorized.', 401);
  
          return redirect()-&gt;guest('login');
      }
  
      if ( ! Auth::user()-&gt;can('access acp') )
      {
          if ($request-&gt;ajax() || $request-&gt;wantsJson())
              return response('Unauthorised.', 403);
  
          abort(403, "You do not have permission to access the Admin Control Panel. If you believe this is an error please contact the admin who set your account up for you.");
      }
  
      return $next($request);
  }
  </code></pre>
  
  <p>So if the user isn't logged in we send them to the login page, otherwise we check if the have permissions to access the acp, and if not show them a 403 error. I've added a 403.blade.php to the views/errors folder. However when I run that code I just get a Whoops! and the developer tools show a 500 ISE is being returned. I don't understand why I'm not seeing my custom error page.</p>
  
  <p>So far I've tried switching the environment to production and turning debug mode off but that doesn't show the page. I've also tried throwing an authorisation exception but that doesn't do anything different. I also tried using <code>App::abort()</code> but again, I still got the 500 ISE. </p>
  
  <p>I've tried Googling the issue but I can't find anyone else having this issue. I would really appreciate any help in getting this working.</p>
  
  <p>Whoops returns</p>
  
  <p><a href="https://i.stack.imgur.com/YDQcV.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/YDQcV.png" alt="Error output"></a></p>
  
  <p>If I modify the code thusly</p>
  
  <pre><code>try
  {
      abort(403, "You do not have permission to access the Admin Control Panel. If you believe this is an error please contact the admin who set your account up for you.");
  } catch ( HttpException $e )
  {
      dd($e);
  }
  </code></pre>
  
  <p>then I get an instance of <code>HttpException</code> with my error code and message, so why isn't that then showing a custom error page?</p>