PhpBench\Model\Error::fromException PHP Метод

fromException() публичный статический Метод

public static fromException ( Exception $exception )
$exception Exception
    public static function fromException(\Exception $exception)
    {
        return new self($exception->getMessage(), get_class($exception), $exception->getCode(), $exception->getFile(), $exception->getLine(), $exception->getTraceAsString());
    }

Usage Example

Пример #1
0
 /**
  * Create an error stack from an Exception.
  *
  * Should be called when an Exception is encountered during
  * the execution of any of the iteration processes.
  *
  * After an exception is encountered the results from this iteration
  * set are invalid.
  *
  * @param \Exception $e
  */
 public function setException(\Exception $exception)
 {
     $errors = [];
     do {
         $errors[] = Error::fromException($exception);
     } while ($exception = $exception->getPrevious());
     $this->errorStack = new ErrorStack($this, $errors);
 }