示例#1
0
 /**
  * Process exception
  *
  * @param \Exception $exception
  * @param array $params
  * @return void
  */
 public function processException(\Exception $exception, array $params = array())
 {
     if ($this->_appState->getMode() == \Magento\Framework\App\State::MODE_DEVELOPER) {
         parent::processException($exception, $params);
     } else {
         $reportData = array($exception->getMessage(), $exception->getTraceAsString()) + $params;
         // retrieve server data
         if (isset($_SERVER)) {
             if (isset($_SERVER['REQUEST_URI'])) {
                 $reportData['url'] = $_SERVER['REQUEST_URI'];
             }
             if (isset($_SERVER['SCRIPT_NAME'])) {
                 $reportData['script_name'] = $_SERVER['SCRIPT_NAME'];
             }
         }
         require_once $this->_filesystem->getPath(\Magento\Framework\App\Filesystem::PUB_DIR) . '/errors/report.php';
     }
 }
示例#2
0
 public function testProcessException()
 {
     $expectedMessage = 'test message';
     $this->expectOutputRegex('/(' . $expectedMessage . ')\\s*?.*(internal function)((.*\\s.*)*)({main})/');
     $this->object->processException(new \Exception($expectedMessage), []);
 }