romanbican / roles

Powerful package for handling roles and permissions in Laravel 5
MIT License
1.16k stars 296 forks source link

catch exceptions inside app/Exceptions/Handler.php #188

Open dmodaii opened 8 years ago

dmodaii commented 8 years ago

I can`t catch Bican\Roles\Exceptions\AccessDeniedException in Handler.php

    use Bican\Roles\Exceptions\AccessDeniedException as AccessDeniedException;

    public function render($request, Exception $e)
    {
        die('sww');
        if ($e instanceof AccessDeniedException) {
          echo 'ss';die();
        }
        die('a');
        return parent::render($request, 'ss');
    }

but postman shows:

{
  "message": "You don't have a required ['admin'] role.",
  "status_code": 500,
}

I have registered middeleware in router, How to catch Bican\Roles\Exceptions\AccessDeniedException in Handler.php