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