Closed stefanorg closed 11 years ago
@ghislainf up
Can you be more specific ?
Yes, in a SkeletonApplication require: "bjyoungblood/bjy-authorize" following the instructions: https://github.com/bjyoungblood/BjyAuthorize
Once enable, BjyAuthorize if you try to visit a resource without a permission (for example the home page for which you need the role 'user') it raise the: UnAuthorizedException (BjyAuthorize\Exception\UnAuthorizedException) and by default it will display the Unauthorized message (403 error page) With whoops enabled in application.config.php it's impossible to see the 403 error message because whoops catch the exception and it shows the PrettyPageHandler error page.
Sorry for my long response time... The exception message of BjyAuthorize\Exception\UnAuthorizedException are currently show in PrettyPageHandler.
In fact, BjyAuthorize\Exception\UnAuthorizedException extends \BadMethodCallException When you throw a \BadMethodCallException exception with a message, it's visible on whoops prettypage.
throw new \BadMethodCallException('hello');
Hi @ghislainf , thanks for your response. The point is that when the application rise the BjyAuthorize\Exception\UnAuthorizedException i DON'T want to see the PrettyPageHandler page, but i want to see the default login page or the "friendly" message to the user "You are not authorized ..."
Practically speaking, i want to tell zfwhoops: "when you see 'BjyAuthorize\Exception\UnAuthorizedException' don't catch him and let zf2 handle that, because that exception is known to me and i throw it voluntarily"
hope you got the point.
ps: sorry for my english
Ok @stefanorg.
Now you can define the specfics exceptions which should not be catch by whoops.
return array(
'view_manager' => array(
'whoops_no_catch' => array(
'BjyAuthorize\Exception\UnAuthorizedException',
'AnotherException',
...
)
)
);
Hi, how to handle checked exception, like BjyAuthorize\Exception\UnAuthorizedException?