mirror of https://github.com/zulip/zulip.git
Funnel exceptions from ajax handlers through blueslip
(imported from commit 5ad08482989d25a0fd0ee02251b74a23f950a0b9)
This commit is contained in:
parent
7510f87eac
commit
dfe69eef0d
|
@ -75,8 +75,9 @@ function BlueslipError() {
|
|||
|
||||
BlueslipError.prototype = Error.prototype;
|
||||
|
||||
// Catch all exceptions from jQuery event handlers and
|
||||
// $(document).ready functions and funnel them through blueslip.
|
||||
// Catch all exceptions from jQuery event handlers, $(document).ready
|
||||
// functions, and ajax success/failure continuations and funnel them
|
||||
// through blueslip.
|
||||
(function() {
|
||||
function wrap_callback(func) {
|
||||
var new_func = function blueslip_wrapper() {
|
||||
|
@ -100,6 +101,14 @@ BlueslipError.prototype = Error.prototype;
|
|||
return new_func;
|
||||
}
|
||||
|
||||
$.ajaxPrefilter(function (options) {
|
||||
$.each(['success', 'error', 'complete'], function (idx, cb_name) {
|
||||
if (options[cb_name] !== undefined) {
|
||||
options[cb_name] = wrap_callback(options[cb_name]);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
if (document.addEventListener) {
|
||||
var orig_on = $.fn.on;
|
||||
var orig_ready = $.fn.ready;
|
||||
|
|
Loading…
Reference in New Issue