All generated results are returned right now. I'm not removing the results that can't be found.

Personally I prefer warnings in stderr. That way I can go back and look through my logs if there is a problem. Or if I'm running it as part of a script (which is what I'll be using it for mostly at the moment) the errors are printed to the screen. Putting warnings as part of the result means that I lose that information unless I write code to retrieve it from the result. A consumer of the gem can easily find the errors since gender is set to nil.

However I can see that knowing that gender is set to nil requires knowledge of the internal workings.

How about if we add errors to the result AND also output to stderr?

Since the ActiveSupportCacheResult is already a hash, will it break ActiveSupport caching to add a key :errors?

Example usage:

res.errors -> ["ksldfjslkjfweuir"]

Your thoughts before I implement it?

Kenton White

On Nov 29, 2013, at 12:40 PM, Kasper Johansen <notifications@github.com> wrote:

> In spec/genderize_io_rb_spec.rb:
> 
> > @@ -53,4 +58,17 @@
> >        gir.info_for_name("ksldfjslkjfweuir")
> >      }.to raise_error(GenderizeIoRb::Errors::NameNotFound)
> >    end
> > +  
> > +  it "can make multiple requests" do
> > +    gir = GenderizeIoRb.new
> > +    res = gir.info_for_name(["kasper", "christina", "ksldfjslkjfweuir"])
> > +    res.result[0].name.should eql("kasper")
> > +    res.result[1].name.should eql("christina")
> > +    $stderr.rewind
> > +    $stderr.string.chomp.should eq("Name was not found on Genderize.io: 'ksldfjslkjfweuir'.")
> Have you considered making it part of the result instead/as well? So its possible to test, if one of the names failed?
> 
> Wouldn't it be logical to return all the results generated as well?
> 
> —
> Reply to this email directly or view it on GitHub.
>