protected function createDetailFromException()
    {
        $e = $this->detail;

        if (!$this->detailIncludesStackTrace) {
            return $this->getExceptionMessage($e);
        }

        $message = $this->getExceptionMessage($e);
        $this->additionalDetails['trace'] = $e->getTrace();

        $previous = [];
        $e = $e->getPrevious();
        while ($e) {
            $previous[] = [
                'code'    => (int) $e->getCode(),
                'message' => $this->getExceptionMessage($e),
                'trace'   => $e->getTrace(),
            ];
            $e = $e->getPrevious();
        }
        if (count($previous)) {
            $this->additionalDetails['exception_stack'] = $previous;
        }

        return $message;
    }