client: Improve logging for basic sync crash

This commit is contained in:
Elian Doran
2024-10-24 18:47:16 +03:00
parent 48b0af1bba
commit 81ca0a3776
6 changed files with 28 additions and 8 deletions

View File

@@ -1,4 +1,5 @@
import Component from "../components/component.js";
import froca from "../services/froca.js";
import { t } from "../services/i18n.js";
import toastService from "../services/toast.js";
@@ -85,11 +86,29 @@ class BasicWidget extends Component {
try {
this.doRender();
} catch (e) {
console.log("Got issue in widget ", this);
console.error(e);
let noteId = this._noteId;
if (this._noteId) {
froca.getNote(noteId, true).then((note) => {
toastService.showPersistent({
title: t("toast.widget-error.title"),
icon: "alert",
message: t("toast.widget-error.message-custom", {
id: noteId,
title: note.title,
message: e.message
})
});
});
return;
}
toastService.showPersistent({
title: t("toast.widget-error.title"),
icon: "alert",
message: t("toast.widget-error.message", {
title: this.widgetTitle,
message: t("toast.widget-error.message-unknown", {
message: e.message
})
});