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:
29
htdocs/includes/raven-js/plugins/ember.js
Normal file
29
htdocs/includes/raven-js/plugins/ember.js
Normal file
@@ -0,0 +1,29 @@
|
||||
/**
|
||||
* Ember.js plugin
|
||||
*
|
||||
* Patches event handler callbacks and ajax callbacks.
|
||||
*/
|
||||
;(function(window, Raven, Ember) {
|
||||
'use strict';
|
||||
|
||||
// quit if Ember isn't on the page
|
||||
if (!Ember) {
|
||||
return;
|
||||
}
|
||||
|
||||
var _oldOnError = Ember.onerror;
|
||||
Ember.onerror = function EmberOnError(error) {
|
||||
Raven.captureException(error);
|
||||
if (typeof _oldOnError === 'function') {
|
||||
_oldOnError.call(this, error);
|
||||
}
|
||||
};
|
||||
Ember.RSVP.on('error', function (reason) {
|
||||
if (reason instanceof Error) {
|
||||
Raven.captureException(reason, {extra: {context: 'Unhandled Promise error detected'}});
|
||||
} else {
|
||||
Raven.captureMessage('Unhandled Promise error detected', {extra: {reason: reason}});
|
||||
}
|
||||
});
|
||||
|
||||
}(window, window.Raven, window.Ember));
|
||||
Reference in New Issue
Block a user