client: Improve logging for some bundle errors

This commit is contained in:
Elian Doran
2024-10-24 20:55:21 +03:00
parent 81ca0a3776
commit eee088316d
3 changed files with 19 additions and 2 deletions

View File

@@ -3,6 +3,7 @@ import server from "./server.js";
import toastService from "./toast.js";
import froca from "./froca.js";
import utils from "./utils.js";
import { t } from "./i18n.js";
async function getAndExecuteBundle(noteId, originEntity = null, script = null, params = null) {
const bundle = await server.post(`script/bundle/${noteId}`, {
@@ -79,6 +80,18 @@ async function getWidgetBundlesByParent() {
widgetsByParent.add(widget);
}
catch (e) {
const noteId = bundle.noteId;
const note = await froca.getNote(noteId);
toastService.showPersistent({
title: t("toast.bundle-error.title"),
icon: "alert",
message: t("toast.bundle-error.message", {
id: noteId,
title: note.title,
message: e.message
})
});
logError("Widget initialization failed: ", e);
continue;
}