Example #1
0
 /** Обработка ошибок */
 protected function handleException(\Exception $e)
 {
     $p = $this->getErrorPage();
     if ($e instanceof \CMSx\Controller\Exception) {
         $h = $e->getHTTPHeader();
         if ($e->isRedirect()) {
             //Для редиректа страница ошибки не выводится
             header('Location: ' . $e->getRedirectUrl());
             header($h);
             return false;
         }
         if ($h) {
             header($h);
         }
         $p->set('title', $e->getHumanMessage());
     } else {
         $p->set('title', 'Ошибка!');
     }
     if ($this->isDebugMode()) {
         $p->setText(HTML::Tag('h3', $e->getMessage()) . "\n" . HTML::Tag('p', nl2br($e->getTraceAsString())));
     }
     $p->set('exception', $e);
     return $p;
 }