Skip to content

Commit 6abc3b9

Browse files
committed
Clarified the Err function
1 parent 655065c commit 6abc3b9

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -223,6 +223,8 @@ Rill provides a wide selection of blocking functions. Some of them are:
223223
[Example](https://pkg.go.dev/github.com/destel/rill#example-Reduce)
224224
- **All:** Concurrently checks if all items in the stream satisfy a user provided condition.
225225
[Example](https://pkg.go.dev/github.com/destel/rill#example-All)
226+
- **Err:** Returns the first error encountered in the stream or nil, and discards the rest.
227+
[Example](https://pkg.go.dev/github.com/destel/rill#example-Err)
226228

227229

228230
All blocking functions share a common behavior. In case of an early termination (before reaching the end of the input stream or in case of an error),
@@ -266,7 +268,7 @@ func CheckAllUsersExist(ctx context.Context, concurrency int, ids []int) error {
266268
return u, nil
267269
})
268270

269-
// Stop at first error and cancel remaining fetches via context
271+
// Return the first error (if any) and cancel remaining fetches via context
270272
return rill.Err(users)
271273
}
272274
```

example_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -331,7 +331,7 @@ func CheckAllUsersExist(ctx context.Context, concurrency int, ids []int) error {
331331
return u, nil
332332
})
333333

334-
// Stop at first error and cancel remaining fetches via context
334+
// Return the first error (if any) and cancel remaining fetches via context
335335
return rill.Err(users)
336336
}
337337

0 commit comments

Comments
 (0)