public function __construct(\Exception $exception) { $this->code = $exception->getCode(); $this->message = $exception->getMessage(); if ($exception instanceof Exception) { $this->details = $exception->getDetails(); } }