From e50b070d08cde532378c1b1020128185dfd19117 Mon Sep 17 00:00:00 2001 From: Robert Lange <robert.lange@uni-leipzig.de> Date: Fri, 26 Feb 2021 14:52:46 +0100 Subject: [PATCH] refs #19222 [finc] fix specific error messages * unwrap BackendException to get TimeoutException * use camelCase for systemEmail view helper in exception templates --- module/finc/src/finc/Bootstrapper.php | 8 ++++++-- themes/finc/templates/error/RuntimeException.phtml | 2 +- themes/finc/templates/error/TimeoutException.phtml | 2 +- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/module/finc/src/finc/Bootstrapper.php b/module/finc/src/finc/Bootstrapper.php index 05b4796ae9b..178435297e4 100644 --- a/module/finc/src/finc/Bootstrapper.php +++ b/module/finc/src/finc/Bootstrapper.php @@ -74,7 +74,11 @@ class Bootstrapper extends \VuFind\Bootstrapper return; } - $exceptionArray = explode('\\', get_class($e->getParam('exception'))); + if ($exception instanceof \VuFindSearch\Backend\Exception\BackendException && $exception->getPrevious()) { + $exception = $exception->getPrevious(); + } + + $exceptionArray = explode('\\', get_class($exception)); $exceptionName = end( $exceptionArray ); @@ -90,7 +94,7 @@ class Bootstrapper extends \VuFind\Bootstrapper $model = new \Zend\View\Model\ViewModel( [ 'display_exceptions' => APPLICATION_ENV == 'development', - 'exception' => $e->getParam('exception'), + 'exception' => $e->getParam('exception'), ] ); $model->setTemplate($template); diff --git a/themes/finc/templates/error/RuntimeException.phtml b/themes/finc/templates/error/RuntimeException.phtml index 0e8933ecf5a..949ab27f13e 100644 --- a/themes/finc/templates/error/RuntimeException.phtml +++ b/themes/finc/templates/error/RuntimeException.phtml @@ -14,7 +14,7 @@ <?php else: ?> <p><?=$this->transEsc($this->message)?></p> <?=$this->transEsc('Please contact the Library Reference Department for assistance')?> - <?php $supportEmail = $this->escapeHtmlAttr($this->systememail()); ?> + <?php $supportEmail = $this->escapeHtmlAttr($this->systemEmail()); ?> <a href="mailto:<?=$supportEmail?>"><?=$supportEmail?></a> <?php endif; ?> <br/> diff --git a/themes/finc/templates/error/TimeoutException.phtml b/themes/finc/templates/error/TimeoutException.phtml index 825b115fa32..70da72eacaf 100644 --- a/themes/finc/templates/error/TimeoutException.phtml +++ b/themes/finc/templates/error/TimeoutException.phtml @@ -8,7 +8,7 @@ ?> <div class="alert alert-danger"> <p> - <?=sprintf($this->translate('error_timeout'), $this->systememail(), $this->systememail())?> + <?=sprintf($this->translate('error_timeout'), $this->systemEmail(), $this->systemEmail())?> <br/> </p> </div> -- GitLab