The control goes to the error block when the inner observable completed execution.
My Component Service Layer - The control goes to the error block.
this.ApplicationService.getPageData(id).subscribe((DataObj)=>{
console.log(DataObj);
},
(error)=>{
console.log('Failed to get data.'); <-- The control comes here
})
In my Application Service Layer -
return this.dbService.queryData(req).pipe(mergeMap((r)=>{
if(r!=null) {
let key : string = r.other_id;
return dbService.queryOtherSource(key).pipe(map((r1)=> {
if(r1) {
obj = do some data processing
return of(obj); <-- Control comes here.
}
},
(err)=> {
throw err;
}));
}
},
(error)=>{
throw error;
}));