December 2018
Intermediate to advanced
196 pages
4h 48m
English
As powerful as observables are, they can’t prevent errors from happening. Instead, they provide a concrete way to gracefully handle errors as they arise. Errors are handled in the subscribe call (same as regular data). So far, the examples have only passed a single parameter to .subscribe—a function that runs for every datum that arrives at the end of the stream. Turns out, a total of three parameters can be passed in (the latter two being optional):
| | .subscribe( |
| | function next(val) { /* A new value has arrived */ }, |
| | function error(err) { /* An error occured */ }, |
| | function done() { /* The observable is done */ } |
| | ); |
The first (the one you’ve been using until this point) is known as the next function. It’s called ...
Read now
Unlock full access