title: How to catch NetworkError in JavaScript?
body: <p>In Chrome's JavaScript console, if I run this:</p>
  
  <pre><code>var that = new XMLHttpRequest();
  that.open('GET', 'http://this_is_a_bad_url.com', false);
  that.send();
  </code></pre>
  
  <p>I get an intentionally expected error:</p>
  
  <pre><code>NetworkError: A network error occurred.
  </code></pre>
  
  <p>I want to catch this, so I use:</p>
  
  <pre><code>var that = new XMLHttpRequest();
  that.open('GET', 'http://this_is_a_bad_url.com', false);
  try {
    that.send();
  } catch(exception) {
    if(exception instanceof NetworkError) {
      console.log('There was a network error.');
    }
  }
  </code></pre>
  
  <p>However, I get an error about NetworkError not being defined:</p>
  
  <pre><code>ReferenceError: NetworkError is not defined
  </code></pre>
  
  <p>How can I catch NetworkError?</p>