Skip to content

Commit 518932a

Browse files
author
vpaladiychuk
committed
MAGETWO-34988: Implement exception handling in dispatch() method
1 parent 41f2fc8 commit 518932a

File tree

2 files changed

+4
-6
lines changed

2 files changed

+4
-6
lines changed

lib/internal/Magento/Framework/App/FrontController.php

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -80,10 +80,8 @@ public function dispatch(RequestInterface $request)
8080
* Handle exception
8181
*
8282
* @param \Exception $e
83-
* @param \Magento\Framework\App\ActionInterface $actionInstance
84-
* @return \Magento\Framework\Controller\Result\Redirect
8583
*/
86-
protected function handleException($e, $actionInstance)
84+
protected function handleException($e)
8785
{
8886
$needToMaskDisplayMessage = !($e instanceof \Magento\Framework\Exception\LocalizedException)
8987
&& ($this->appState->getMode() != State::MODE_DEVELOPER);
@@ -92,7 +90,6 @@ protected function handleException($e, $actionInstance)
9290
: $e->getMessage();
9391
$this->messageManager->addError($displayMessage);
9492
$this->logger->critical($e->getMessage());
95-
return $actionInstance->getDefaultRedirect();
9693
}
9794

9895
/**
@@ -116,7 +113,8 @@ protected function processRequest(RequestInterface $request)
116113
} catch (Action\NotFoundException $e) {
117114
throw $e;
118115
} catch (\Exception $e) {
119-
$result = $this->handleException($e, $actionInstance);
116+
$this->handleException($e);
117+
$result = $actionInstance->getDefaultRedirect();
120118
}
121119
break;
122120
}

lib/internal/Magento/Framework/App/Test/Unit/FrontControllerTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
namespace Magento\Framework\App\Test\Unit;
77

88
use Magento\Framework\App\Action\NotFoundException;
9-
use \Magento\Framework\App\State;
9+
use Magento\Framework\App\State;
1010

1111
class FrontControllerTest extends \PHPUnit_Framework_TestCase
1212
{

0 commit comments

Comments
 (0)