I'm learning Phalcon (trying REST API in multi-module application template), and I did simple checking for each request, "does this request contain specific header" for example x-api-key (something like ActionFilters in ASP.NET MVC). 
I tried doing it with
annotations,plugins,beforeExecuteRoute, andbeforeException. But when I write in one of themthrow new \Exception("Some exception", 500);then Phalcon returns a blank page without an exception message and code. AFAIK this is a known bug.I tried to do it with the
dispatcherinbeforeException:
     public function beforeException($event, $dispatcher, $exception)
     {
        if ($exception instanceof \Phalcon\Http\Request\Exception)
        {
            $dispatcher->forward(
                    array(
                        'controller' => 'error',
                        'action' => 'showInternalServerError'
                    )
            );
            return false;
        }
        //...
      }
and it seems that's working, but this is not an elegant solution and I'm too lazy for this :)
QUESTION: Do you have any better ideas how to do ActionFilters in PhalconPHP?