title: Error handling with Observables in Angular 2
body: <p>I'm trying to pass any errors that might occur in an HTTP request to a common logging service from all my services:</p>
  
  <pre><code>import { Observable } from 'rxjs/Observable';
  import 'rxjs/add/operator/catch';
  
  constructor(logger: LoggerService) { }
  
  doSomething(): Observable&lt;any&gt; {
      return this.http
          .post('/foo/bar', {})
          .catch(this.notifyErrors);
  }
  
  protected notifyErrors(error: any): Observable&lt;any&gt; {
      this.logger.log(error);
  
      return Observable.throw(error);
  }
  </code></pre>
  
  <p>Unfortunately, inside the <code>notifyErrors</code> method, <code>this</code> is lost. I've tried defining this as a fat arrow, but i get type errors from the TS compiler. I've used the exact syntax in the Observable documentation. </p>