callbag-catch-error
Callbag operator to catch errors thrown by pullable or listenable sources.
- Handles errors when fetching data, working with promises, etc.
- Proves useful while consuming sources with callbag-for-each or callbag-iterate by André Staltz.
- Works well with callbag-throw-error by Mateusz Burzyński.
If you wonder what this is all about, you should definitely check out the awesome Callbag standard for reactive and iterable programming.
.
Behavior
- Data from pullable and listenable sources without errors are passed to sinks.
- Errors thrown by pullable and listenable sources get caught.
- Pullable sources stop emitting on error as expected.
- Listenable sources continue emitting after error as expected.
.
Example 1: Pullable stream
const flatten fromIter fromPromise map pipe = ;const iterate = ;const fetch = ;const catchError = ; ; /* Logs the following:- 404 Not Found */
.
Example 2: Listenable stream
const flatten forEach fromPromise interval map pipe take = ;const fetch = ;const catchError = ; ; /* Logs the following:- 404 Not Found- Luke Skywalker */