Prev Next

Web / RxJs Interview questions

How do you perform error handling in observables?

You can handle errors by specifying an error callback on the observer instead of relying on try/catch which are ineffective in asynchronous environment.

For example, you may define the error callback as below.

myObservable.subscribe({next(num) {console.log("next value:" + num)},
error (err) {console.log("Received error:" + err)}
});

More Related questions...

Show more question and Answers...


Comments & Discussions