Better error reporting, defensive measure when parsing URI