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);
     }
 }
Ejemplo n.º 2
0
 /**
  * @param int $convertError
  *
  * @return $this
  */
 public function setConvertError($convertError)
 {
     $value = is_bool($convertError) ? $convertError ? E_ALL : static::E_NONE : $this->toInt($convertError);
     $this->convertError = $value;
     // Refresh the handler if necessary
     ErrorHandler::started() and ErrorHandler::clean();
     if ($this->convertError !== static::E_NONE) {
         ErrorHandler::start($value);
     }
     return $this;
 }