<?php 
$errorMessage = $this->exception->getMessage();
$displayThrow = true;
if(strstr($errorMessage, 'session has already been started') != null)
{
	$errorMessage = "<br>Atmail requires <strong>session.auto_start</strong> to be set to false in your php.ini.<br>Please correct this by ensuring the following line in php configuration and restarting webserver:<br><br>session.auto_start = 0<br>";
	$displayThrow = false;
}
else
{
	echo $errorMessage; 
}

//TODO: convert this to db config var like the others
$debug = (isset(Zend_Registry::get('config')->global['debug'])? Zend_Registry::get('config')->global['debug']:false);
if( $debug == true || $debug == 'true' || $debug == 1 ) : 

	if($this->exception->getMessage() == 'Access denied'): 
		echo $this->exception->getMessage();

	else : 
?> 
  	<h2><?php echo $this->error ?></h2> 

	<?php if (true || $this->env == 'development'): ?> 
		<h3>Exception information:</h3> 
	  	<p> 
	    	<b>Message:<br></b> <?php echo $errorMessage ?> 
	  	</p> 
	<?php if ($displayThrow) : ?>
	  	<strong>Thrown in:</strong> <?php echo $this->exception->getFile() . ', Line #:' . $this->exception->getLine() . ', Code #: ' . $this->exception->getCode() ?>

		<h3>Stack trace:</h3> 
	  	<pre><?php echo $this->exception->getTraceAsString() ?></pre> 

	  	<!--
	  	<h3>Request Parameters:</h3> 
	  	<pre><?php echo print_r($this->request->getParams(),1) ?></pre> 
	  	-->
	  	<?php endif ?>
	<?php endif ?>
	<?php 
	endif;
endif;
?>