Esempio n. 1
0
 /**
  * Test handler() method with 'false' result
  *
  * @param int $errorNo
  * @param string $errorPhrase
  * @dataProvider handlerProviderException
  */
 public function testHandlerException($errorNo, $errorPhrase)
 {
     $errorStr = 'test_string';
     $errorFile = 'test_file';
     $errorLine = 'test_error_line';
     $exceptedExceptionMessage = sprintf('%s: %s in %s on line %s', $errorPhrase, $errorStr, $errorFile, $errorLine);
     $this->setExpectedException('Exception', $exceptedExceptionMessage);
     $this->object->handler($errorNo, $errorStr, $errorFile, $errorLine);
 }
Esempio n. 2
0
 /**
  * Show error as exception or log it
  *
  * @param string $errorMessage
  * @throws \Exception
  * @return void
  */
 protected function _processError($errorMessage)
 {
     if ($this->_appState->getMode() == \Magento\Framework\App\State::MODE_DEVELOPER) {
         parent::_processError($errorMessage);
     } else {
         $exception = new \Exception($errorMessage);
         $errorMessage .= $exception->getTraceAsString();
         $this->_logger->log($errorMessage, \Zend_Log::ERR);
     }
 }