Comment attraper NetworkError en JavaScript?

Dans la console JavaScript de Chrome, si je lance ce:

var that = new XMLHttpRequest();
that.open('GET', 'http://this_is_a_bad_url.com', false);
that.send();

- Je obtenir une intentionnellement prévu d'erreur:

NetworkError: A network error occurred.

Je veux attraper cela, j'utilise donc:

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.');
  }
}

Cependant, je reçois une erreur sur NetworkError n'est pas définie:

ReferenceError: NetworkError is not defined

Comment puis-je attraper NetworkError?

source d'informationauteur Synthead