/** * Actually handle the exception. * @param $exception */ private function processException($exception) { Tier::clearOutputBuffer(); //TODO - we are now failing. Replace error handler with instant //shutdown handler. $fallBackHandler = ['Tier\\Tier', 'processException']; if (class_exists('\\Throwable') === true) { $fallBackHandler = ['Tier\\Tier', 'processThrowable']; } $handler = $this->exceptionResolver->getExceptionHandler($exception, $fallBackHandler); try { call_user_func($handler, $exception); } catch (\Exception $e) { Tier::clearOutputBuffer(); // The exception handler function also threw? Just exit. //Fatal error shutdown echo $e->getMessage(); exit(-1); } catch (\Throwable $e) { Tier::clearOutputBuffer(); //Fatal error shutdown echo $e->getMessage(); exit(-1); } }