Skip to content

Build your personal knowledge base with Trilium Notes

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

Elian Doran0f7446c19832
diff --git a/src/public/app/widgets/basic_widget.js b/src/public/app/widgets/basic_widget.js
index 0f94a1c0fb..75373238ee 100644
--- a/src/public/app/widgets/basic_widget.js
+++ b/src/public/app/widgets/basic_widget.js
@@ -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
diff --git a/src/public/app/widgets/right_panel_widget.js b/src/public/app/widgets/right_panel_widget.js
index 767b89c3e8..a9831fb5aa 100644
--- a/src/public/app/widgets/right_panel_widget.js
+++ b/src/public/app/widgets/right_panel_widget.js
@@ -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();
}
/**