summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Adam Chlipala <adamc@hcoop.net>2009-02-15 11:33:53 -0500
committerGravatar Adam Chlipala <adamc@hcoop.net>2009-02-15 11:33:53 -0500
commite2d8010cf8e5334b58713404e9e146b18292ef73 (patch)
tree33b3f75fb6281eca4712436ac1af5d2a8da69c75
parenta2199267e2408ebed10bb6dad01bdbdf891c0cc6 (diff)
Detect AJAX call failures
-rw-r--r--lib/js/urweb.js15
1 files changed, 13 insertions, 2 deletions
diff --git a/lib/js/urweb.js b/lib/js/urweb.js
index 9dd4dbbe..bfca94a4 100644
--- a/lib/js/urweb.js
+++ b/lib/js/urweb.js
@@ -133,8 +133,19 @@ function rc(uri, k) {
var xhr = getXHR();
xhr.onreadystatechange = function() {
- if (xhr.readyState == 4)
- k(xhr.responseText);
+ if (xhr.readyState == 4) {
+ var isok = false;
+
+ try {
+ if (xhr.status == 200)
+ isok = true;
+ } catch (e) { }
+
+ if (isok)
+ k(xhr.responseText);
+ else
+ alert("Error querying remote server!");
+ }
};
xhr.open("GET", uri, true);