I'm trying to create a service that handle technical errors but i'm facing an issue. The type of the returned item change if i do a catch:
Observable.of(1, 2, 3).subscribe(
item => {}, // item type is number
error => {}
);
Observable.of(1, 2, 3).catch(error => {
// do something
throw error;
}).subscribe(
item => {}, // item type is number | {}
error => {}
);
Is there a way to keep the item type as only a number when catching an observable ?
Context: I'm trying to share the handle of web services throught multiple service:
- WepAPI.Service will handle technical error (404, 500, ...)
- ComponentRelated.Service will handle functional process and error
- Component will handle data transformation specific to the UI
Maybe i'm not doing it the good way, any advice/sample would be aprreciated.
Thank