getMessage()); parent::__construct($message, $exception->getCode(), $exception); } /** * Return a raw (unformatted) version of the error message. * * @return string */ public function getRawMessage() { return $this->getPrevious()->getMessage(); } /** * Create a ThrowUpException from a Throwable. * * @param \Throwable $throwable * * @return ThrowUpException */ public static function fromThrowable($throwable) { if ($throwable instanceof \Error) { $throwable = ErrorException::fromError($throwable); } if (!$throwable instanceof \Exception) { throw new \InvalidArgumentException('throw-up can only throw Exceptions and Errors'); } return new self($throwable); } }