Raise URI::InvalidURIError if wrong uri.

Until we implement our own parser, raise URI::InvalidURIError  when gid is incorrect