Which exceptions are being caught with beforeException?

So in my actions some functions may throw an exception, so I wanted to handle those in a single place. I thought a beforeException event was exactly what I was looking for. However I could not get it working.

Basically that's what I was doing ```php $eventsManager = new Phalcon\Events\Manager(); $eventsManager->attach("dispatch", function($event, $dispatcher, $exception) { die(var_dump("Got there")); }); $this->getDI()->get("dispatcher")->setEventsManager($eventsManager); ``` and then in action for example ```php public function indexAction() { throw new \Exception("test"); } ```

However it didn't work. Exceptions thrown in actions were not caught. So, maybe they have to be specific exceptions?

This is working for me: ```php $eventsManager->attach("dispatch:beforeException", ... ```



8.0k

Would you please post more code? It seems like i'm doing exactly the same thing, but it doesn't work. BTW, which Phalcon version are you on? I'm using 1.3.0 latest compilation.