Observable and Http errors
See original GitHub issueCan anybody explain me the mechanism of error handling? For example, I have 2 subscribers on one observer
let observable = this.authService.signIn(formGroup.value.email, formGroup.value.password);
// 1st subscriber
observable.subscribe((response: SignInResponse) => {
console.log('First - Success');
}, () => {
console.log('First - Error');
}, () => {
console.log('First - Finally');
});
// 2nd subscriber
observable.subscribe((response: SignInResponse) => {
console.log('Second - Success');
}, () => {
console.log('Second - Error');
}, () => {
console.log('Second - Finally');
});`
If I get 400 from the server - both error messages First - Error, Second - Error appears as expected, but if I remove error and finally callback for the first subscriber as
let observable = this.authService.signIn(formGroup.value.email, formGroup.value.password);
observable.subscribe((response: SignInResponse) => {
console.log('First - Success');
});
observable.subscribe((response: SignInResponse) => {
console.log('Second - Success');
}, () => {
console.log('Second - Error');
}, () => {
console.log('Second - Finally');
});
I don’t get the error callback of the second subscriber
Issue Analytics
- State:
- Created 6 years ago
- Comments:9 (4 by maintainers)
Top Results From Across the Web
How does HTTP error-handling work with observables?
Means: When you subscribe to a HTTP call, you always automatically get a success if you do not explicitly do Observable.throw ? Ok,...
Read more >RxJs Error Handling: Complete Practical Guide
The Observable Contract and Error Handling. In order to understand error handling in RxJs, we need to first understand that any given stream...
Read more >How to handle and catch errors in Rxjs
In short, we learn how to pipe the data and catch the errors using catchError , to modify the return observable or use...
Read more >Angular HTTP Error Handling - TekTutorialsHub
In this guide, we learn about Angular HTTP Error Handling. Whenever the error occurs in an HTTP operation, the Angular wraps it in...
Read more >Handling Exceptions Using the Angular HttpClient Service
Catching HTTP Exceptions ... Using the catchError operator gives you the ability to catch errors that may occur within an observable stream. Let's ......
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Yes, it will work. Thanks for your answer. Issue can be closed
I´m using http instead of restangular here because of this issue, https://github.com/2muchcoffeecom/ng2-restangular/issues/14#issuecomment-272466188