Skip to content
Snippets Groups Projects

Draft: Remove ajaxError.sentry event handler

Closed Miguel Rincon requested to merge mrincon-remove-ajaxError-sentry into master
1 unresolved thread
Files
2
import * as Sentry from '@sentry/browser';
import $ from 'jquery';
import { __ } from '~/locale';
const IGNORE_ERRORS = [
@@ -53,7 +52,6 @@ const SentryConfig = {
this.options = options;
this.configure();
this.bindSentryErrors();
if (this.options.currentUserId) this.setUser();
},
@@ -78,29 +76,6 @@ const SentryConfig = {
id: this.options.currentUserId,
});
},
bindSentryErrors() {
$(document).on('ajaxError.sentry', this.handleSentryErrors);
    • Author Maintainer

      I attempted to trigger ajax errors manually on my GDK and this handler was never run. I suspect this is not used.

      As we move away from jQuery.ajax it should still make sense to remove this, as even if it works it would not provide good coverage over global errors.

Please register or sign in to reply
},
handleSentryErrors(event, req, config, err) {
const error = err || req.statusText;
const { responseText = __('Unknown response text') } = req;
const { type, url, data } = config;
const { status } = req;
Sentry.captureMessage(error, {
extra: {
type,
url,
data,
status,
response: responseText,
error,
event,
},
});
},
};
export default SentryConfig;
Loading