♻️ error tracking: better integration with UI
This commit is contained in:
1 parent
805159b07f
commit
2e4c3fed24
3 files changed
+33
-10
No files matched your search
@@ -8,18 +8,14 @@
|
||||
Sentry.init({
|
||||
dsn: errortracking_url_coreui,
|
||||
release: VERSION,
|
||||
whitelistUrls: [
|
||||
// only include static assets
|
||||
"/static/"
|
||||
],
|
||||
blacklistUrls: [
|
||||
// exclude third party plugins
|
||||
"/static/webassets/packed_plugins.js"
|
||||
allowUrls: [
|
||||
// only include errors raise in HTML, packed core & client
|
||||
{% assets "js_client" %}"{{ ASSET_URL }}",{% endassets %}
|
||||
{% assets "js_core" %}"{{ ASSET_URL }}",{% endassets %}
|
||||
{% if g.locale %}"{{ url_for('localeJs', locale=g.locale, domain='messages') }}"{% endif %}
|
||||
]
|
||||
});
|
||||
Sentry.configureScope(function (scope) {
|
||||
scope.setUser({"id": errortracking_unique_id});
|
||||
});
|
||||
Sentry.setUser({"id": errortracking_unique_id});
|
||||
ERRORTRACKING_ENABLED = true;
|
||||
log.info("Initialized error tracking");
|
||||
};
|
||||
|
||||
@@ -1259,6 +1259,9 @@ function setOnViewModelIf(viewModel, key, value, condition) {
|
||||
|
||||
viewModel[key] = value;
|
||||
} catch (exc) {
|
||||
if (Sentry) {
|
||||
Sentry.captureException(exc);
|
||||
}
|
||||
log.error("Error while setting", key, "to", value, "on view model", viewModel.constructor.name, ":", (exc.stack || exc));
|
||||
}
|
||||
}
|
||||
@@ -1274,6 +1277,9 @@ function callViewModelsIf(allViewModels, method, condition, callback) {
|
||||
try {
|
||||
callViewModelIf(viewModel, method, condition, callback);
|
||||
} catch (exc) {
|
||||
if (Sentry) {
|
||||
Sentry.captureException(exc);
|
||||
}
|
||||
log.error("Error calling", method, "on view model", viewModel.constructor.name, ":", (exc.stack || exc));
|
||||
}
|
||||
});
|
||||
@@ -1333,6 +1339,9 @@ function callViewModelIf(viewModel, method, condition, callback, raiseErrors) {
|
||||
callback(viewModel[method], viewModel);
|
||||
}
|
||||
} catch (exc) {
|
||||
if (Sentry) {
|
||||
Sentry.captureException(exc);
|
||||
}
|
||||
if (raiseErrors) {
|
||||
throw exc;
|
||||
} else {
|
||||
|
||||
@@ -385,6 +385,9 @@ $(function() {
|
||||
try {
|
||||
viewModelInstance = _createViewModelInstance(viewModel, viewModelMap, optionalDependencyPass);
|
||||
} catch (exc) {
|
||||
if (Sentry) {
|
||||
Sentry.captureException(exc);
|
||||
}
|
||||
log.error("Error instantiating", viewModel.name, ":", (exc.stack || exc));
|
||||
continue;
|
||||
}
|
||||
@@ -598,6 +601,9 @@ $(function() {
|
||||
_.each(allViewModelData, function (viewModelData) {
|
||||
try {
|
||||
if (!Array.isArray(viewModelData) || viewModelData.length !== 2) {
|
||||
if (Sentry) {
|
||||
Sentry.captureException(new Error("View model data for" + viewModelData.constructor.name + "has wrong format, expected 2-tuple (viewModel, targets), got:" + viewModelData));
|
||||
}
|
||||
log.error("View model data for", viewModelData.constructor.name, "has wrong format, expected 2-tuple (viewModel, targets), got:", viewModelData);
|
||||
return;
|
||||
}
|
||||
@@ -617,6 +623,9 @@ $(function() {
|
||||
try {
|
||||
callViewModel(viewModel, "onBeforeBinding", undefined, true);
|
||||
} catch (exc) {
|
||||
if (Sentry) {
|
||||
Sentry.captureException(exc);
|
||||
}
|
||||
log.error("Error calling onBeforeBinding on view model", viewModel.constructor.name, ":", (exc.stack || exc));
|
||||
return;
|
||||
}
|
||||
@@ -639,6 +648,9 @@ $(function() {
|
||||
try {
|
||||
object = $(target);
|
||||
} catch (exc) {
|
||||
if (Sentry) {
|
||||
Sentry.captureException(exc);
|
||||
}
|
||||
log.error("Error while attempting to jquery-fy target", target, "of view model", viewModel.constructor.name, ":", (exc.stack || exc));
|
||||
return;
|
||||
}
|
||||
@@ -665,6 +677,9 @@ $(function() {
|
||||
|
||||
log.debug("View model", viewModel.constructor.name, "bound to", target);
|
||||
} catch (exc) {
|
||||
if (Sentry) {
|
||||
Sentry.captureException(exc);
|
||||
}
|
||||
log.error("Could not bind view model", viewModel.constructor.name, "to target", target, ":", (exc.stack || exc));
|
||||
}
|
||||
});
|
||||
@@ -702,6 +717,9 @@ $(function() {
|
||||
|
||||
viewModelMap["uiStateViewModel"].loading(false);
|
||||
} catch (exc) {
|
||||
if (Sentry) {
|
||||
Sentry.captureException(exc);
|
||||
}
|
||||
viewModelMap["uiStateViewModel"].showLoadingError("Application startup failed.");
|
||||
throw(exc);
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user