From b74b6db213e6a870617e22e5e55a6f113b5848c6 Mon Sep 17 00:00:00 2001 From: Demian Katz <demian.katz@villanova.edu> Date: Thu, 21 Jun 2012 15:09:13 -0400 Subject: [PATCH] Fixed rendering of error pages. --- .../blueprint/templates/error/index.phtml | 21 +++++++++++++---- .../vufind/root/templates/error/index.phtml | 23 ++++++++++++++----- 2 files changed, 33 insertions(+), 11 deletions(-) diff --git a/themes/vufind/blueprint/templates/error/index.phtml b/themes/vufind/blueprint/templates/error/index.phtml index 9e7beaf2457..df89e483dd5 100644 --- a/themes/vufind/blueprint/templates/error/index.phtml +++ b/themes/vufind/blueprint/templates/error/index.phtml @@ -8,7 +8,7 @@ <p> <?=$this->transEsc('Please contact the Library Reference Department for assistance')?> <br/> - <? $supportEmail = $this->escape(VF_Config_Reader::getConfig()->Site->email); ?> + <? $supportEmail = $this->escape(\VuFind\Config\Reader::getConfig()->Site->email); ?> <a href="mailto:<?=$supportEmail?>"><?=$supportEmail?></a> </p> </div> @@ -20,7 +20,7 @@ <?=$this->transEsc('upgrade_description', array(), 'If you are upgrading a previous VuFind version, you can load your old settings with this tool.')?> <? endif; ?> -<? if (isset($this->exception)): ?> +<? if (isset($this->display_exceptions) && $this->display_exceptions): ?> <h3><?=$this->transEsc('Exception')?>:</h3> <p> <b><?=$this->transEsc('Message')?>:</b> <?=$this->exception->getMessage()?> @@ -30,7 +30,18 @@ <pre><?=$this->exception->getTraceAsString()?> </pre> - <h3><?=$this->transEsc('error_page_parameter_list_heading')?>:</h3> - <pre><?=$this->escape(var_export($this->request->getParams(), true))?> - </pre> + <? if ($e = $this->exception->getPrevious()): ?> + <h3>Previous exceptions:</h2> + <? while($e): ?> + <h4><?php echo get_class($e); ?></h4> + <p><?=$e->getMessage()?></p> + <pre><?=$e->getTraceAsString()?></pre> + <? $e = $e->getPrevious(); ?> + <? endwhile; ?> + <? endif; ?> + + <? if (isset($this->request)): ?> + <h3><?=$this->transEsc('error_page_parameter_list_heading')?>:</h3> + <pre><?=$this->escape(var_export($this->request->getParams(), true))?></pre> + <? endif; ?> <? endif ?> diff --git a/themes/vufind/root/templates/error/index.phtml b/themes/vufind/root/templates/error/index.phtml index 03d9a1f724e..67428a78dd6 100644 --- a/themes/vufind/root/templates/error/index.phtml +++ b/themes/vufind/root/templates/error/index.phtml @@ -8,17 +8,28 @@ <?=$this->transEsc('upgrade_description', array(), 'If you are upgrading a previous VuFind version, you can load your old settings with this tool.')?> <? endif; ?> -<? if (isset($this->exception)): ?> +<? if (isset($this->display_exceptions) && $this->display_exceptions): ?> <h3><?=$this->transEsc('Exception')?>:</h3> <p> <b><?=$this->transEsc('Message')?>:</b> <?=$this->exception->getMessage()?> </p> - + <h3><?=$this->transEsc('Backtrace')?>:</h3> <pre><?=$this->exception->getTraceAsString()?> </pre> - - <h3><?=$this->transEsc('error_page_parameter_list_heading')?>:</h3> - <pre><?=$this->escape(var_export($this->request->getParams(), true))?> - </pre> + + <? if ($e = $this->exception->getPrevious()): ?> + <h3>Previous exceptions:</h2> + <? while($e): ?> + <h4><?php echo get_class($e); ?></h4> + <p><?=$e->getMessage()?></p> + <pre><?=$e->getTraceAsString()?></pre> + <? $e = $e->getPrevious(); ?> + <? endwhile; ?> + <? endif; ?> + + <? if (isset($this->request)): ?> + <h3><?=$this->transEsc('error_page_parameter_list_heading')?>:</h3> + <pre><?=$this->escape(var_export($this->request->getParams(), true))?></pre> + <? endif; ?> <? endif ?> -- GitLab