/** * 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); } }
/** * */ 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); } }