throw exception if uri is null