title: Angular 4 - Observable catch error
body: <p>How can I solve the problem of return with error, use the capture inside the Observable?</p>
  
  <p>I want to execute a function inside the catch, to do some validation before the subscribe is executed.</p>
  
  <p>Thank you in advance, thank you very much for your attention.</p>
  
  <p>Error occurs  in -> .catch( (e) => {console.log(e)} )</p>
  
  <pre><code>import { Injectable } from '@angular/core';
  import { Headers, Http, ResponseOptions} from '@angular/http';
  import { AuthHttp } from 'angular2-jwt';
  
  import { MEAT_API } from '../app.api';
  
  import { Observable } from 'rxjs/Observable';
  import 'rxjs/add/operator/map';
  import 'rxjs/add/operator/catch';
  
  @Injectable()
  export class  CompareNfeService {
  
  
      constructor(private http: AuthHttp) { }
  
      envirArquivos(order): Observable&lt;any&gt; {
          const headers = new Headers();
          return this.http.post(`${MEAT_API}compare/arquivo`, order,
          new ResponseOptions({headers: headers}))
          .map(response =&gt; response.json())
          .catch( (e) =&gt; {console.log(e)} );
      }
  }
  </code></pre>
  
  <p>Error</p>
  
  <blockquote>
    <p>ERROR in /XXXXXX/application/src/app/compare/service.ts (28,17):
    Argument of type '(e: any) => void' is not assignable to parameter of
    type '(err: any, caught: Observable) => ObservableInput&lt;{}>'.<br>
    Type 'void' is not assignable to type 'ObservableInput&lt;{}>'.</p>
  </blockquote>