mirror of
https://github.com/zadam/trilium.git
synced 2025-06-06 18:08:33 +02:00
client: Display errors for all basic widgets instead of just right panel widget
This commit is contained in:
parent
0ba9fc7f5b
commit
0f7446c198
@ -1,5 +1,6 @@
|
|||||||
import Component from "../components/component.js";
|
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.
|
* This is the base widget for all other widgets.
|
||||||
@ -81,7 +82,18 @@ class BasicWidget extends Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
|
try {
|
||||||
this.doRender();
|
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.attr('data-component-id', this.componentId);
|
||||||
this.$widget
|
this.$widget
|
||||||
|
@ -1,6 +1,4 @@
|
|||||||
import NoteContextAwareWidget from "./note_context_aware_widget.js";
|
import NoteContextAwareWidget from "./note_context_aware_widget.js";
|
||||||
import toastService from "../services/toast.js";
|
|
||||||
import { t } from "../services/i18n.js";
|
|
||||||
|
|
||||||
const WIDGET_TPL = `
|
const WIDGET_TPL = `
|
||||||
<div class="card widget">
|
<div class="card widget">
|
||||||
@ -56,19 +54,7 @@ class RightPanelWidget extends NoteContextAwareWidget {
|
|||||||
this.$buttons.append(buttonWidget.render());
|
this.$buttons.append(buttonWidget.render());
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
|
||||||
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
|
|
||||||
})
|
|
||||||
});
|
|
||||||
logError(e);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
x
Reference in New Issue
Block a user