Skip to content

Build your personal knowledge base with Trilium Notes

client: Stop crash if right widget crashes during render

Elian Doran48b0af1bbace
diff --git a/src/public/app/widgets/right_panel_widget.js b/src/public/app/widgets/right_panel_widget.js
index a9831fb5aa..cb28aac439 100644
--- a/src/public/app/widgets/right_panel_widget.js
+++ b/src/public/app/widgets/right_panel_widget.js
@@ -1,4 +1,6 @@
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">
@@ -54,7 +56,16 @@ class RightPanelWidget extends NoteContextAwareWidget {
this.$buttons.append(buttonWidget.render());
}
- this.initialized = this.doRenderBody();
+ 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
+ })
+ });
+ });
}
/**