/** * @param \Error|\Exception|string[]|string $throwableOrMessage */ public function __construct($throwableOrMessage) { if ($throwableOrMessage instanceof \Error || $throwableOrMessage instanceof \Exception) { $prev = $throwableOrMessage->getPrevious(); $this->class = get_class($throwableOrMessage); $this->message = $throwableOrMessage->getMessage(); $this->prev = $prev === null ? null : new ThrowableProxy($prev); } else { if (is_array($throwableOrMessage)) { $this->class = $throwableOrMessage[0]; $this->message = $throwableOrMessage[1]; $this->prev = null; } else { $this->class = 'Exception'; $this->message = $throwableOrMessage; $this->prev = null; } } }