public function _handleException($e)
{
if (!$this->_inError && ($handler = $this->_application->errorHandler())) {
$this->_inError = true;
$handler->handle($e);
$this->_inError = false;
} else {
if (php_sapi_name() == 'cli') {
echo $e->__toString();
exit(1);
} else {
header('HTTP/1.1 500 Internal Server Error');
echo "<h1>Error: " . $e->getMessage() . '</h1>';
echo '<pre>' . $e->__toString() . '</pre>';
exit(1);
}
}
}