コード例 #1
0
ファイル: manager.php プロジェクト: cepharum/txf
 /**
  * Catches exceptions not catched in code for embedding rendered exception
  * description in selected page design (if possible).
  *
  * @param \Exception $exception
  */
 public function onException(\Exception $exception)
 {
     if ($exception instanceof \ErrorException) {
         if ($exception->getCode() & E_NOTICE) {
             return;
         }
     }
     if ($exception instanceof \de\toxa\txf\http_exception) {
         header($exception->getResponse());
     }
     $this->accessVariable('exception', $exception);
     static::addBodyClass('exception');
     try {
         try {
             $code = $this->engine->render('exception', variable_space::create('exception', $exception));
         } catch (\Exception $e) {
             $code = locale::get('failed to render exception');
         }
         $this->viewport('error', $code);
         if (txf::getContextMode() == txf::CTXMODE_REWRITTEN) {
             // this mode does not have registered shutdown handler
             // --> call it explicitly here
             $this->onShutdown();
         }
     } catch (\Exception $e) {
         echo '<h1>Failed to render exception</h1>';
         echo self::simpleRenderException($exception);
         echo '<h1>Encountered error was</h1>';
         echo self::simpleRenderException($e);
     }
     exit;
 }