Fix JS ErrorHandling issue 3704 (#3706)
* #3704 Correction of Sentry Handling
This commit is contained in:
1 parent
69247460a1
commit
513a7bf4b1
3 files changed
+10
-9
No files matched your search
@@ -123,6 +123,7 @@ date of first contribution):
|
||||
* [Khoi Pham](https://github.com/osubuu)
|
||||
* [Federico Nembrini](https://github.com/FedericoNembrini)
|
||||
* [Uri Shaked](https://github.com/urish)
|
||||
* [Ollis Git](https://github.com/OllisGit)
|
||||
|
||||
OctoPrint started off as a fork of [Cura](https://github.com/daid/Cura) by
|
||||
[Daid Braam](https://github.com/daid). Parts of its communication layer and
|
||||
|
||||
@@ -1259,7 +1259,7 @@ function setOnViewModelIf(viewModel, key, value, condition) {
|
||||
|
||||
viewModel[key] = value;
|
||||
} catch (exc) {
|
||||
if (Sentry) {
|
||||
if (typeof Sentry !== 'undefined') {
|
||||
Sentry.captureException(exc);
|
||||
}
|
||||
log.error("Error while setting", key, "to", value, "on view model", viewModel.constructor.name, ":", (exc.stack || exc));
|
||||
@@ -1277,7 +1277,7 @@ function callViewModelsIf(allViewModels, method, condition, callback) {
|
||||
try {
|
||||
callViewModelIf(viewModel, method, condition, callback);
|
||||
} catch (exc) {
|
||||
if (Sentry) {
|
||||
if (typeof Sentry !== 'undefined') {
|
||||
Sentry.captureException(exc);
|
||||
}
|
||||
log.error("Error calling", method, "on view model", viewModel.constructor.name, ":", (exc.stack || exc));
|
||||
@@ -1339,7 +1339,7 @@ function callViewModelIf(viewModel, method, condition, callback, raiseErrors) {
|
||||
callback(viewModel[method], viewModel);
|
||||
}
|
||||
} catch (exc) {
|
||||
if (Sentry) {
|
||||
if (typeof Sentry !== 'undefined') {
|
||||
Sentry.captureException(exc);
|
||||
}
|
||||
if (raiseErrors) {
|
||||
|
||||
@@ -386,7 +386,7 @@ $(function() {
|
||||
try {
|
||||
viewModelInstance = _createViewModelInstance(viewModel, viewModelMap, optionalDependencyPass);
|
||||
} catch (exc) {
|
||||
if (Sentry) {
|
||||
if (typeof Sentry !== 'undefined') {
|
||||
Sentry.captureException(exc);
|
||||
}
|
||||
log.error("Error instantiating", viewModel.name, ":", (exc.stack || exc));
|
||||
@@ -602,7 +602,7 @@ $(function() {
|
||||
_.each(allViewModelData, function (viewModelData) {
|
||||
try {
|
||||
if (!Array.isArray(viewModelData) || viewModelData.length !== 2) {
|
||||
if (Sentry) {
|
||||
if (typeof Sentry !== 'undefined') {
|
||||
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);
|
||||
@@ -624,7 +624,7 @@ $(function() {
|
||||
try {
|
||||
callViewModel(viewModel, "onBeforeBinding", undefined, true);
|
||||
} catch (exc) {
|
||||
if (Sentry) {
|
||||
if (typeof Sentry !== 'undefined') {
|
||||
Sentry.captureException(exc);
|
||||
}
|
||||
log.error("Error calling onBeforeBinding on view model", viewModel.constructor.name, ":", (exc.stack || exc));
|
||||
@@ -649,7 +649,7 @@ $(function() {
|
||||
try {
|
||||
object = $(target);
|
||||
} catch (exc) {
|
||||
if (Sentry) {
|
||||
if (typeof Sentry !== 'undefined') {
|
||||
Sentry.captureException(exc);
|
||||
}
|
||||
log.error("Error while attempting to jquery-fy target", target, "of view model", viewModel.constructor.name, ":", (exc.stack || exc));
|
||||
@@ -678,7 +678,7 @@ $(function() {
|
||||
|
||||
log.debug("View model", viewModel.constructor.name, "bound to", target);
|
||||
} catch (exc) {
|
||||
if (Sentry) {
|
||||
if (typeof Sentry !== 'undefined') {
|
||||
Sentry.captureException(exc);
|
||||
}
|
||||
log.error("Could not bind view model", viewModel.constructor.name, "to target", target, ":", (exc.stack || exc));
|
||||
@@ -718,7 +718,7 @@ $(function() {
|
||||
|
||||
viewModelMap["uiStateViewModel"].loading(false);
|
||||
} catch (exc) {
|
||||
if (Sentry) {
|
||||
if (typeof Sentry !== 'undefined') {
|
||||
Sentry.captureException(exc);
|
||||
}
|
||||
viewModelMap["uiStateViewModel"].showLoadingError("Application startup failed.");
|
||||
|
||||
Reference in new issue
Block a user