Skip to content

Commit 9a414a2

Browse files
committed
consistent error handling
1 parent bab1fc8 commit 9a414a2

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

logtail.js

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -116,10 +116,7 @@ function get_log() {
116116

117117
setTimeout(get_log, poll);
118118
} else {
119-
if (s == "error")
120-
error(xhr.statusText);
121-
else
122-
error("AJAX Error: " + s);
119+
throw "Unknown AJAX Error (status " + xhr.status + ")";
123120
}
124121
}
125122
});
@@ -163,10 +160,12 @@ function error(what) {
163160
"Reloading may help; no promises.\r\n" +
164161
what);
165162
scroll(0);
163+
164+
return false;
166165
}
167166

168167
$(document).ready(function () {
169-
$(window).error(error);
168+
window.onerror = error;
170169

171170
/* If URL is /logtail/?noreverse display in chronological order */
172171
var hash = location.search.replace(/^\?/, "");

0 commit comments

Comments
 (0)