Skip to content
Permalink
Browse files

OXDEV-2380 Fixed variable naming in addErrorToDisplay method in Utils…

…View Class
  • Loading branch information...
Farzam Tahmasebmirza
Farzam Tahmasebmirza committed Aug 29, 2019
1 parent 19425da commit 53f5f6487a38cc63e56206c9be0eec6bdfa01533
Showing with 26 additions and 28 deletions.
  1. +26 −28 source/Core/UtilsView.php
@@ -141,7 +141,7 @@ public function passAllErrorsToView(&$aView, $errors)
* by default is displayed in the inc_header, but with the custom destination set to true
* the exception won't be displayed by default but can be displayed where ever wanted in the tpl
*
* @param StandardException|IDisplayError|string $oEr an exception object or just a language local (string),
* @param StandardException|IDisplayError|string $exception an exception object or just a language local (string),
* which will be converted into a oxExceptionToDisplay object
* @param bool $blFull if true the whole object is add to display (default false)
* @param bool $useCustomDestination true if the exception shouldn't be displayed
@@ -151,7 +151,7 @@ public function passAllErrorsToView(&$aView, $errors)
* @param string $activeController defines a name of the controller, which should
* handle the error.
*/
public function addErrorToDisplay($oEr, $blFull = false, $useCustomDestination = false, $customDestination = "", $activeController = "")
public function addErrorToDisplay($exception, $blFull = false, $useCustomDestination = false, $customDestination = "", $activeController = "")
{
//default
$destination = 'default';
@@ -168,39 +168,37 @@ public function addErrorToDisplay($oEr, $blFull = false, $useCustomDestination =
$session->start();
}
$aEx = \OxidEsales\Eshop\Core\Registry::getSession()->getVariable('Errors');
if ($oEr instanceof \OxidEsales\Eshop\Core\Exception\StandardException) {
$oEx = oxNew(\OxidEsales\Eshop\Core\Exception\ExceptionToDisplay::class);
$oEx->setMessage($oEr->getMessage());
$oEx->setExceptionType($oEr->getType());
$sessionErrors = \OxidEsales\Eshop\Core\Registry::getSession()->getVariable('Errors');
if ($exception instanceof \OxidEsales\Eshop\Core\Exception\StandardException) {
$exceptionToDisplay = oxNew(\OxidEsales\Eshop\Core\Exception\ExceptionToDisplay::class);
$exceptionToDisplay->setMessage($exception->getMessage());
$exceptionToDisplay->setExceptionType($exception->getType());
if ($oEr instanceof \OxidEsales\Eshop\Core\Exception\SystemComponentException) {
$oEx->setMessageArgs($oEr->getComponent());
if ($exception instanceof \OxidEsales\Eshop\Core\Exception\SystemComponentException) {
$exceptionToDisplay->setMessageArgs($exception->getComponent());
}
$oEx->setValues($oEr->getValues());
$oEx->setStackTrace($oEr->getTraceAsString());
$oEx->setDebug($blFull);
$oEr = $oEx;
} elseif ($oEr instanceof \Throwable) {
// assuming that a string was given
$sTmp = $oEr;
$oEr = oxNew(\OxidEsales\Eshop\Core\DisplayError::class);
$oEr->setMessage($sTmp->getTraceAsString());
} elseif ($oEr && !($oEr instanceof \OxidEsales\Eshop\Core\Contract\IDisplayError)) {
// assuming that a string was given
$sTmp = $oEr;
$oEr = oxNew(\OxidEsales\Eshop\Core\DisplayError::class);
$oEr->setMessage($sTmp);
} elseif ($oEr instanceof \OxidEsales\Eshop\Core\Contract\IDisplayError) {
$exceptionToDisplay->setValues($exception->getValues());
$exceptionToDisplay->setStackTrace($exception->getTraceAsString());
$exceptionToDisplay->setDebug($blFull);
$exception = $exceptionToDisplay;
} elseif ($exception instanceof \Throwable) {
$tempException = $exception;
$exception = oxNew(\OxidEsales\Eshop\Core\DisplayError::class);
$exception->setMessage($tempException->getTraceAsString());
} elseif ($exception && !($exception instanceof \OxidEsales\Eshop\Core\Contract\IDisplayError)) {
$tempException = $exception;
$exception = oxNew(\OxidEsales\Eshop\Core\DisplayError::class);
$exception->setMessage($tempException);
} elseif ($exception instanceof \OxidEsales\Eshop\Core\Contract\IDisplayError) {
// take the object
} else {
$oEr = null;
$exception = null;
}
if ($oEr) {
$aEx[$destination][] = serialize($oEr);
\OxidEsales\Eshop\Core\Registry::getSession()->setVariable('Errors', $aEx);
if ($exception) {
$sessionErrors[$destination][] = serialize($exception);
\OxidEsales\Eshop\Core\Registry::getSession()->setVariable('Errors', $sessionErrors);
if ($activeController == '') {
$activeController = \OxidEsales\Eshop\Core\Registry::getConfig()->getRequestParameter('actcontrol');

0 comments on commit 53f5f64

Please sign in to comment.
You can’t perform that action at this time.