Check if ajaxError.sentry event handler is used
Summary
We have an error handler to report errors to Sentry that may not be working. We could consider removing it or updating it.
Description
In app/assets/javascripts/sentry/sentry_config.js
I was trying to find how the following affects our Sentry setup:
bindSentryErrors() {
$(document).on('ajaxError.sentry', this.handleSentryErrors);
},
It doesn't seem to be documented, so I tried to a naive test by doing:
diff --git a/app/assets/javascripts/sentry/sentry_config.js b/app/assets/javascripts/sentry/sentry_config.js
index a3a2c794a67..118c88bcf86 100644
--- a/app/assets/javascripts/sentry/sentry_config.js
+++ b/app/assets/javascripts/sentry/sentry_config.js
@@ -84,6 +84,8 @@ const SentryConfig = {
},
handleSentryErrors(event, req, config, err) {
+ console.log('Reporing ajaxError.sentry', event, req, config, err);
+
const error = err || req.statusText;
const { responseText = __('Unknown response text') } = req;
const { type, url, data } = config;
And issuing an ajax call:
mounted() {
fetch('fake-url'); // my component
},
The error is shown in the console but there is not report done to Sentry or console log: