client: Display errors for all basic widgets instead of just right panel widget

This commit is contained in:
Elian Doran 2024-07-27 12:26:35 +03:00
parent 0ba9fc7f5b
commit 0f7446c198
No known key found for this signature in database
2 changed files with 15 additions and 17 deletions

View File

@ -1,5 +1,6 @@
import Component from "../components/component.js";
import { t } from "../services/i18n.js";
import toastService from "../services/toast.js";
/**
* This is the base widget for all other widgets.
@ -81,7 +82,18 @@ class BasicWidget extends Component {
}
render() {
this.doRender();
try {
this.doRender();
} catch (e) {
toastService.showPersistent({
title: t("toast.widget-error.title"),
icon: "alert",
message: t("toast.widget-error.message", {
title: this.widgetTitle,
message: e.message
})
});
}
this.$widget.attr('data-component-id', this.componentId);
this.$widget

View File

@ -1,6 +1,4 @@
import NoteContextAwareWidget from "./note_context_aware_widget.js";
import toastService from "../services/toast.js";
import { t } from "../services/i18n.js";
const WIDGET_TPL = `
<div class="card widget">
@ -56,19 +54,7 @@ class RightPanelWidget extends NoteContextAwareWidget {
this.$buttons.append(buttonWidget.render());
}
try {
this.initialized = this.doRenderBody();
} catch (e) {
toastService.showPersistent({
title: t("toast.widget-error.title"),
icon: "alert",
message: t("toast.widget-error.message", {
title: this.widgetTitle,
message: e.message
})
});
logError(e);
}
this.initialized = this.doRenderBody();
}
/**