fix(pagination): handle errors when applying options

This commit is contained in:
stainless-app[bot]
2025-04-30 16:19:56 +00:00
parent ff828094b5
commit eebf84bf19

View File

@@ -149,7 +149,10 @@ func (r *CursorPage[T]) GetNextPage() (res *CursorPage[T], err error) {
cfg := r.cfg.Clone(r.cfg.Context)
value := reflect.ValueOf(items[len(items)-1])
field := value.FieldByName("ID")
cfg.Apply(option.WithQuery("after", field.Interface().(string)))
err = cfg.Apply(option.WithQuery("after", field.Interface().(string)))
if err != nil {
return nil, err
}
var raw *http.Response
cfg.ResponseInto = &raw
cfg.ResponseBodyInto = &res