title: Catch a 404 error for XHR
body: <p>Basically, I had to create a javascript APP object, which will queue an sequence of asynchronous requests for the server, process response to JSON, and log errors from it. </p>
  
  <p>JSON processing errors were caught easily with "try-catch", but server errors like 404, 500 etc. are still shown in the console of the browser, while I need to silently log it in "APP.history".</p>
  
  <p>I tried to implement it via the code below, but none of 404 errors fires one error. What am I doing wrong?</p>
  
  <pre><code>xhr = new XMLHttpRequest();
  xhr.open("GET", url, true)
  xhr.onerror = function(){console.log("error")}  
  xhr.upload.onerror = function(){console.log("error")}
  </code></pre>
  
  <p>By the way, how could it be done with jQuery AJAX?</p>