2
0
forked from Wavyzz/dolibarr

New Added client-side Sentry logging

Using Raven.js allows logging client-side javascript errors to the
configured Sentry server.
This commit is contained in:
Raphaël Doursenaud
2015-08-31 17:21:03 +02:00
parent 7ef5cbfb96
commit a6ef289470
47 changed files with 7872 additions and 9 deletions

View File

@@ -0,0 +1,33 @@
/**
* native plugin
*
* Extends support for global error handling for asynchronous browser
* functions. Adopted from Closure Library's errorhandler.js.
*/
;(function extendToAsynchronousCallbacks(window, Raven) {
"use strict";
var _helper = function _helper(fnName) {
var originalFn = window[fnName];
window[fnName] = function ravenAsyncExtension() {
// Make a copy of the arguments
var args = [].slice.call(arguments);
var originalCallback = args[0];
if (typeof (originalCallback) === 'function') {
args[0] = Raven.wrap(originalCallback);
}
// IE < 9 doesn't support .call/.apply on setInterval/setTimeout, but it
// also supports only two arguments and doesn't care what this is, so we
// can just call the original function directly.
if (originalFn.apply) {
return originalFn.apply(this, args);
} else {
return originalFn(args[0], args[1]);
}
};
};
_helper('setTimeout');
_helper('setInterval');
}(window, window.Raven));