I have a method in a service class that relies on an http get using an Id. My method returns an Observable with different properties that the rest of my app depends on.
getCat(catNumber: string): Observable<ICat> {
const url = `${this.serviceURL}Cat/${catNumber}`;
return this._http.get(url).map(this.extractResponse).catch(this.handleError);
}
the problem i am having is that the method that calls this expects an ICat object. If the server responds with a 404 for no cat found that blows up the rest of the application. How can i check what the status code is and return something that my other method could use. Even if it is a Cat object with an invalid id?