I'm using observables for Http calls, which have been working fine, but then I changed up my controllers and noticed that my code apparently isn't handling errors.
Here is a look at the code from my service (SellingMenuService):
public getVarieties(): Observable<any> {
return this.http.get(this.varietyListUrl).map(response => {
return response.json();
}, (error: any) => {
console.log(error);
console.log('error finding variety list');
// TODO: implement error handling here.
});
}
And here is the relevant code from my component:
constructor(public sellingMenuService: SellingMenuService) { }
getVarietyList(): void {
this.sellingMenuService.getVarieties().subscribe(res => {
console.log(res);
this.varieties = res;
});
}
And here are some errors in my console:
If I'm getting a 500 error, shouldn't those console logs from my service above get hit? Why don't they?