示例#1
0
 /**
  * @param Throwable|Exception $e
  */
 public function __construct($e)
 {
     // PDOException::getCode() is a string.
     // @see http://php.net/manual/en/class.pdoexception.php#95812
     parent::__construct($e->getMessage(), (int) $e->getCode());
     $this->classname = get_class($e);
     $this->file = $e->getFile();
     $this->line = $e->getLine();
     $this->serializableTrace = $e->getTrace();
     foreach ($this->serializableTrace as $i => $call) {
         unset($this->serializableTrace[$i]['args']);
     }
     if ($e->getPrevious()) {
         $this->previous = new self($e->getPrevious());
     }
 }
示例#2
0
文件: Error.php 项目: scrobot/Lumen
 /**
  * Constructor.
  *
  * @param string $message
  * @param int $code
  * @param string $file
  * @param int $line
  * @param Exception $previous
  */
 public function __construct($message, $code, $file, $line, Exception $previous = null)
 {
     parent::__construct($message, $code, $previous);
     $this->file = $file;
     $this->line = $line;
 }
示例#3
0
 public function __construct($message)
 {
     parent::__construct($message);
 }
示例#4
0
 /**
  * Make the exception message more informative.
  * @param $e Exception
  * @param $testObject string
  * @return Exception
  */
 protected function improveException($e, $testObject)
 {
     $improvedMessage = "Error while testing {$testObject}: " . $e->getMessage();
     if (is_a($e, 'PHPUnit_Framework_ExpectationFailedException')) {
         $e = new PHPUnit_Framework_ExpectationFailedException($improvedMessage, $e->getComparisonFailure());
     } elseif (is_a($e, 'PHPUnit_Framework_Exception')) {
         $e = new PHPUnit_Framework_Exception($improvedMessage, $e->getCode());
     }
     return $e;
 }
示例#5
0
 public function __construct($message = '', $code = 0, \Exception $previous = null)
 {
     $previous = $previous;
     parent::__construct($message, $code, $previous);
 }