protected function echoExceptionWeb($exception)
{
$statusCode = 500;
if ($exception instanceof FlowException) {
$statusCode = $exception->getStatusCode();
}
$statusMessage = Response::getStatusMessageByCode($statusCode);
$referenceCode = $exception instanceof FlowException ? $exception->getReferenceCode() : null;
if (!headers_sent()) {
header(sprintf('HTTP/1.1 %s %s', $statusCode, $statusMessage));
}
try {
if (isset($this->renderingOptions['templatePathAndFilename'])) {
try {
echo $this->buildView($exception, $this->renderingOptions)->render();
} catch (\Throwable $throwable) {
$this->renderStatically($statusCode, $throwable);
} catch (\Exception $exception) {
$this->renderStatically($statusCode, $exception);
}
} else {
echo $this->renderStatically($statusCode, $referenceCode);
}
} catch (\Exception $innerException) {
$this->systemLogger->logException($innerException);
}
}