Ejemplo n.º 1
0
 /**
  * Capture Error converted to exception, then trigger a dispatch error
  * @param MvcEvent $e
  */
 public function onEvent(MvcEvent $event)
 {
     $exception = ErrorHandler::stop();
     if ($exception instanceof \Exception) {
         $event->setError(Application::ERROR_EXCEPTION);
         $event->setParam('exception', $exception);
         $this->getEventManager()->trigger($event::EVENT_DISPATCH_ERROR, $event);
     } elseif (!$event->getError() && $event->getResponse()->getStatusCode() == 404) {
         $event->setError(Application::ERROR_CONTROLLER_CANNOT_DISPATCH);
         $this->getEventManager()->trigger($event::EVENT_DISPATCH_ERROR, $event);
     }
 }