title: Angular 4 - interceptor handle net::ERR_CONNECTION_REFUSED
body: <p>In the code bellow, I try to intercept my http requests. Whenever I can establish a http connection, my interceptor works, but when I got <code>net::ERR_CONNECTION_REFUSED</code>, the <code>event</code> variable is not a instance of <code>HttpResponse</code>, so I can't deal with this kind of error. Here is my code:</p>
  
  <pre><code>intercept(req: HttpRequest&lt;any&gt;, next: HttpHandler): Observable&lt;HttpEvent&lt;any&gt;&gt; {
      this.changeStatus(false);
      this.requests_count++;
      const my_req = req.clone({
          url: API_PATH + req.url
      });
      return next
          .handle(my_req)
          .do(event =&gt; {
              if (event instanceof HttpResponse) {
                  this.requests_count--;
                  if (!this.requests_count)
                      this.changeStatus(true);
              }
          });
  }
  </code></pre>
  
  <p>How can I detect in the interceptor errors like <code>net::ERR_CONNECTION_REFUSED</code>?</p>