protected function convertErrorToString(\Throwable $e, $withTrace = true) {
        $message = [
            $e->getMessage(),
            !empty($e->getFile()) ? $e->getFile() . ' #' . $e->getLine() : "",
            $e->getTraceAsString(),
        ];
        if ($withTrace) {
            $message[] = $e->getTraceAsString();
            if ($e->getPrevious() !== null) {
                $message[] = $this->convertErrorToString($e->getPrevious(), false);
            }
        }
        return implode("\n", $message);
    }
protected function convertErrorToString(\Throwable $e, $withTrace = true) {
        $message = [
            $e->getMessage(),
            !empty($e->getFile()) ? $e->getFile() . ' #' . $e->getLine() : "",
            $e->getTraceAsString(),
        ];
        if ($withTrace) {
            $message[] = $e->getTraceAsString();
            if ($e->getPrevious() !== null) {
                $message[] = $this->convertErrorToString($e->getPrevious(), false);
            }
        }
        return implode("\n", $message);
    }
protected function convertErrorToString ( \ Throwable $ e , $ withTrace = true ) { $ message = [ $ e -> getMessage ( ) , ! empty ( $ e -> getFile ( ) ) ? $ e -> getFile ( ) . ' #' . $ e -> getLine ( ) : "" , $ e -> getTraceAsString ( ) , ] ; if ( $ withTrace ) { $ message [ ] = $ e -> getTraceAsString ( ) ; if ( $ e -> getPrevious ( ) !== null ) { $ message [ ] = $ this -> convertErrorToString ( $ e -> getPrevious ( ) , false ) ; } } return implode ( "\n" , $ message ) ; }
Convert exception to string
@param \Throwable $e
@param bool       $withTrace
@return string
Convert exception to string