What is the best way to handle errors with iterators?
I found three, but which should be preferable or maybe I've missed some?
```go
type Object smth.Smth
type Paginator interface {
GetNext(ctx) ([]Object, error) // func doing heavy request over internet
}
```
```go
func Iter(ctx, data) iter.Seq2[Object, error]
for obj, err := Iter(...) {
if err != nil {
return err
}
// do smth with Object
}
```
```go
func IterWithErr(ctx, data, err *error) iter.Seq[Object]
var err error
for obj := IterWithErr(..., &err) {
// do smth with Object
}
if err != nil {
return err
}
```
```go
func IterOverIter(ctx, data) iter.Seq2[iter.Seq[Object], error]
for page, err := IterOverIter(...) {
if err != nil {
return err
}
for obj := page(...) {
// do smth with Object
}
}
```