caolan/highland — pull request #97 by vqvu (2014-06-01 02:46:13+00:00)
Title: Add error handling for all stream methods that take a function.

This partly solves #94.

Here is the list of affected functions, in order of appearance on the http://highlandjs.org. It describes the behavior of the method if the user-provided function throws.

- `errors` - Emits the error.
- `filter` - Emits error in place of the value.
- `find` - Same as `filter`. Implemented with `filter`.
- `group` - Emits the error instead of grouping. Implemented with `reduce`.
- `map` - Emits error in place of the mapped value.
- `reduce` - Emits no value, just the error (since the reduction didn't complete).
- `reduce1` - Same as `reduce`. Implemented with `reduce`.
- `scan` - Emits all intermediate values produced before the error plus the error. Nothing else after that.
- `scan1` - Same as `scan`. Implemented with `scan`.
- `stopOnError` - Emits the error.
- `flatFilter` - Same as filter. Implemented with `flatMap`. Emits an error if
the function returned an empty stream.
- `flatMap` - Same as `map`. Implemented with `map`.

Did I miss anything?