コード例 #1
0
ファイル: ExceptionHandler.php プロジェクト: n2n/n2n
 /**
  * Decides what exception infos should be rendered. 
  * 
  * @param \Throwable $t
  */
 private function dispatchException(\Throwable $t)
 {
     array_unshift($this->dispatchingThrowables, $t);
     $numDispatchingThrowables = sizeof($this->dispatchingThrowables);
     if (!N2N::isInitialized() || 2 < $numDispatchingThrowables || 2 == $numDispatchingThrowables && !$this->dispatchingThrowables[1] instanceof StatusException || !$this->stable) {
         if (!isset($_SERVER['HTTP_HOST'])) {
             $this->renderExceptionConsoleInfo($t);
             return;
         }
         $this->renderFatalExceptionsHtmlInfo($this->dispatchingThrowables);
         return;
     }
     if (!N2N::isHttpContextAvailable()) {
         $this->renderExceptionConsoleInfo($t);
         return;
     }
     try {
         $this->renderBeautifulExceptionView($t);
     } catch (\Throwable $t) {
         $this->handleThrowable($t);
     }
 }
コード例 #2
0
ファイル: N2N.php プロジェクト: n2n/n2n
 /**
  * 
  */
 public static function shutdown()
 {
     self::$exceptionHandler->checkForFatalErrors();
     if (!self::$exceptionHandler->isStable()) {
         return;
     }
     try {
         if (!N2N::isInitialized()) {
             return;
         }
         if (N2N::isHttpContextAvailable()) {
             N2N::getCurrentResponse()->flush();
         }
     } catch (\Throwable $t) {
         self::$exceptionHandler->handleThrowable($t);
     }
 }