LiveLoveApp logo

Errors in RxJS

Errors in RxJS

  • In addition to emitting values, observables in RxJS can also emit errors
  • Observers can be notified of errors by providing an onError callback function
  • If an observable emits an error, it will not emit any further values
  • Throwing an error is final and it equivalent to the observable completing
getUsers$.subscribe({
  next: (users) => console.log(users),
  error: (err) => console.error(err),
});