1.

How do you deal with errors in observables?

Answer»

Instead of depending on try/catch, which is useless in an asynchronous context, you may manage problems by setting an error callback on the observer.

Example: You may create an error callback as shown below.

myObservable.subscribe({
   next(number) { console.log('Next number: ' + number)},
   error(err) { console.log('An error received ' + err)}
 });


Discussion

No Comment Found