title: Angular 4 - Return HttpErrorResponse from interceptor
body: <p>This in my interceptor</p>
  
  <pre><code>intercept(req: HttpRequest&lt;any&gt;, next: HttpHandler): Observable&lt;HttpEvent&lt;any&gt;&gt; {
      return next.handle(req)
        .catch(err =&gt; {
          if (err instanceof HttpErrorResponse) {
            this.errorControl(req, err.status);
            return Observable.throw(err);
          }
        });
    }
  </code></pre>
  
  <p>I need to catch the error sent from the server in my component since I have to act accordingly (404: return to last url, 400: show a message, etc). When I catch the error in the subscription to the observable I get this</p>
  
  <pre><code>"You provided 'undefined' where a stream was expected. You can provide an Observable, Promise, Array, or Iterable."
  </code></pre>
  
  <p>but I need a HttpErrorResponse with its status, status text, etc.</p>
  
  <p>Removing the interceptor solves my problem, but I need it for all the session stuff.</p>