protected function handleRecursiveError($exception)
{
if ($this->getApplication()->getMode() === TApplicationMode::Debug) {
echo "<html><head><title>Recursive Error</title></head>\n";
echo "<body><h1>Recursive Error</h1>\n";
echo "<pre>" . $exception->__toString() . "</pre>\n";
echo "</body></html>";
} else {
error_log("Error happened while processing an existing error:\n" . $exception->__toString());
header('HTTP/1.0 500 Internal Error');
}
}