title: How to handle net::ERR_CONNECTION_REFUSED in Angular2
body: <p><a href="https://angular.cn/docs/ts/latest/guide/server-communication.html#!#error-handling" rel="noreferrer">error-handling</a> shows how to handle errors as follows:</p>
  
  <pre><code>private handleError (error: Response | any) {
    // In a real world app, we might use a remote logging infrastructure
    let errMsg: string;
    if (error instanceof Response) {
      const body = error.json() || '';
      const err = body.error || JSON.stringify(body);
      errMsg = `${error.status} - ${error.statusText || ''} ${err}`;
    } else {
      errMsg = error.message ? error.message : error.toString();
    }
    console.error(errMsg);
    return Promise.reject(errMsg);
  }
  </code></pre>
  
  <p>I'd like to access an API server, but the server hasn't started. Then I got the error:</p>
  
  <pre><code>http://localhost:3000/api/heroes net::ERR_CONNECTION_REFUSED
  </code></pre>
  
  <p>I need to <strong>tell the user politely that the API server hasn't started</strong>. How should I handle the error?</p>
  
  <p>The error Response is:</p>
  
  <pre><code>_body:ProgressEvent
  headers:Headers
  ok:false
  status:0
  statusText:""
  type:3
  url:null
  </code></pre>
  
  <p>Could I handle this according to the <strong>status</strong> of the response?</p>