Check out example codes for "observable subscribe error". It will help you in understanding the concepts better.

Code Example 1

const obs$ = this.http.get<Course[]>('/api/courses'); 

obs$.subscribe(
  res => console.log('HTTP response', res), // response
  err => console.log('HTTP Error', err), // error
  () => console.log('HTTP request completed.') // finished
);

Learn ReactJs, React Native from akashmittal.com