Skip to content
This repository was archived by the owner on Jun 24, 2025. It is now read-only.

Commit 0f7446c

Browse files
committed
client: Display errors for all basic widgets instead of just right panel widget
1 parent 0ba9fc7 commit 0f7446c

File tree

2 files changed

+15
-17
lines changed

2 files changed

+15
-17
lines changed

src/public/app/widgets/basic_widget.js

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import Component from "../components/component.js";
2-
2+
import { t } from "../services/i18n.js";
3+
import toastService from "../services/toast.js";
34

45
/**
56
* This is the base widget for all other widgets.
@@ -81,7 +82,18 @@ class BasicWidget extends Component {
8182
}
8283

8384
render() {
84-
this.doRender();
85+
try {
86+
this.doRender();
87+
} catch (e) {
88+
toastService.showPersistent({
89+
title: t("toast.widget-error.title"),
90+
icon: "alert",
91+
message: t("toast.widget-error.message", {
92+
title: this.widgetTitle,
93+
message: e.message
94+
})
95+
});
96+
}
8597

8698
this.$widget.attr('data-component-id', this.componentId);
8799
this.$widget

src/public/app/widgets/right_panel_widget.js

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
11
import NoteContextAwareWidget from "./note_context_aware_widget.js";
2-
import toastService from "../services/toast.js";
3-
import { t } from "../services/i18n.js";
42

53
const WIDGET_TPL = `
64
<div class="card widget">
@@ -56,19 +54,7 @@ class RightPanelWidget extends NoteContextAwareWidget {
5654
this.$buttons.append(buttonWidget.render());
5755
}
5856

59-
try {
60-
this.initialized = this.doRenderBody();
61-
} catch (e) {
62-
toastService.showPersistent({
63-
title: t("toast.widget-error.title"),
64-
icon: "alert",
65-
message: t("toast.widget-error.message", {
66-
title: this.widgetTitle,
67-
message: e.message
68-
})
69-
});
70-
logError(e);
71-
}
57+
this.initialized = this.doRenderBody();
7258
}
7359

7460
/**

0 commit comments

Comments
 (0)