コード例 #1
0
 public function testCatchException()
 {
     $message = 'Test catchException()';
     try {
         throw new \Exception($message);
     } catch (\Exception $e) {
         $this->_exceptionHandler->catchException($e);
     } finally {
         $errorArray = IController::getErrorArray();
         $errorIndex = count($errorArray) - 1;
         $errorArray = $errorArray[$errorIndex];
         $this->assertEquals($errorArray['message'], $message);
     }
 }
コード例 #2
0
ファイル: LogFile.php プロジェクト: ignaszak/php-exception
 /**
  * Returns formated error array
  *
  * @return array
  */
 private function loadLogDisplay() : array
 {
     $array = array();
     $count = 1;
     foreach (IController::getErrorArray() as $value) {
         $array[] = "#{$count} [{$value['type']}]";
         $array[] = "    {$value['message']} in {$value['file']} " . "on line {$value['line']}";
         ++$count;
         if (!empty($value['trace'])) {
             $array[] = "    [Backtrace]:";
             foreach ($value['trace'] as $trace) {
                 $message = str_replace("\n", "\n            ", $trace['message']);
                 $array[] = "        {$message}";
                 $array[] = "              IN: {$trace['file']}";
                 $array[] = "              ARGUMENTS:";
                 $array[] = "                  " . str_replace("\n", "\n                  ", $trace['arguments']);
             }
         }
         $array[] = "\n";
     }
     return array('errors' => implode("\n", $array), 'errorsCount' => $count - 1);
 }
コード例 #3
0
 private function getErrorArray()
 {
     $errorArray = IController::getErrorArray();
     $errorIndex = count($errorArray) - 1;
     return $errorArray[$errorIndex];
 }
コード例 #4
0
ファイル: Display.php プロジェクト: lucasnpinheiro/exception
 /**
  * @return array
  */
 private function getErrorArray() : array
 {
     return IController::getErrorArray();
 }