public function dispatch($action) { try { Mage::helper('M2ePro/Module_Exception')->setFatalErrorHandler(); parent::dispatch($action); } catch (Exception $exception) { if ($this->getRequest()->getControllerName() == Mage::helper('M2ePro/Module_Support')->getPageControllerName()) { exit($exception->getMessage()); } else { if (Mage::helper('M2ePro/Module')->isDevelopmentEnvironment()) { throw $exception; } else { Mage::helper('M2ePro/Module_Exception')->process($exception); if (($this->getRequest()->isGet() || $this->getRequest()->isPost()) && !$this->getRequest()->isXmlHttpRequest()) { $this->_getSession()->addError(Mage::helper('M2ePro/Module_Exception')->getUserMessage($exception)); $params = array('error' => 'true'); if (!is_null(Mage::helper('M2ePro/View')->getCurrentView())) { $params['referrer'] = Mage::helper('M2ePro/View')->getCurrentView(); } $this->_redirect(Mage::helper('M2ePro/Module_Support')->getPageRoute(), $params); } else { exit($exception->getMessage()); } } } } }