By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,340 Members | 1,642 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,340 IT Pros & Developers. It's quick & easy.

catch an exception from event handler

Dormilich
Expert Mod 5K+
P: 8,639
I was wondering, where I should catch an exception thrown from a function that is executed onevent…

Expand|Select|Wrap|Line Numbers
  1. // let’s say we have an AJAX call
  2. XHR.onreadystatechange = function ()
  3. {
  4.     if (4 === this.readyState) {
  5.         if (200 !== this.status) {
  6.             throw new Error("Error: " + this.statusText);
  7.         }
  8.         // process response
  9.     }
  10. };
this would be OK for most GET/POST requests, but what to do if I make a HEAD request and get a 404 status?
Feb 4 '10 #1
Share this Question
Share on Google+
1 Reply


Dormilich
Expert Mod 5K+
P: 8,639
well, at least I found that I can use the onerror event handler in Firefox.
Feb 6 '10 #2

Post your reply

Sign in to post your reply or Sign up for a free account.