final public function createQueryException(string $query, \Throwable $previous = null): QueryException
    {
        return new QueryException($this->getLastMessage() ?: 'Database error', $query, 0, $previous);
    }
final public function createQueryException(string $query, \Throwable $previous = null): QueryException
    {
        return new QueryException($this->getLastMessage() ?: 'Database error', $query, 0, $previous);
    }
final public function createQueryException ( string $ query , \ Throwable $ previous = null ) : QueryException { return new QueryException ( $ this -> getLastMessage ( ) ? : 'Database error' , $ query , 0 , $ previous ) ; }
Creates a QueryException with the last message, if no last message exists then uses 'Database error'

@param string $query
@param \Throwable|null $previous
@return QueryException
Creates a QueryException with the last message if no last message exists then uses Database error