If my initial Observable encounters an error, then I will not subscribe to the switchMap Observable.
Is this achievable?
this._profileService.updateProfile(profile).pipe(
tap(profile => {
this.profile = profile;
this.saving = false;
this.updateForm(this.profile);
}),
catchError(error => {
console.log(error);
this.saving = false;
this.updateForm();
return this._pjNotificationService.show(PjNotificationType.ERROR, 'Error while saving',
`An error occurred while saving. ${error}`, 15000)
}),
switchMap(() => this._pjNotificationService.show(PjNotificationType.SAVED, 'Changes saved', '', 15000))
).subscribe();