When implementing a "fetcher' for my dataloader, I'm not clear on what should be returned, specifically the slice of errors was causing a panic for me.
Essentially I was doing a query which returned two elements, and was returning []items, []error{nil}. This failed as the loader logic seemed to need batch.errors[1] which did not exist of course. I changed my logic so that it returned []items, nil when successful, but what should I return if there is an error? should []error contain an entry for each of the items ...? Maybe its better to just return error and "wrap" up any child errors if they exist ...?
Thanks for the report. Yeah, I'll change it to return an error about the bug in the fetch function and a best guess about what error belongs to this result.
When implementing a "fetcher' for my dataloader, I'm not clear on what should be returned, specifically the slice of errors was causing a panic for me.
Essentially I was doing a query which returned two elements, and was returning []items, []error{nil}. This failed as the loader logic seemed to need batch.errors[1] which did not exist of course. I changed my logic so that it returned []items, nil when successful, but what should I return if there is an error? should []error contain an entry for each of the items ...? Maybe its better to just return error and "wrap" up any child errors if they exist ...?