Build your personal knowledge base with Trilium Notes
TypeScript electronelectron-appknowledge-baseknowledge-graphknowledge-managementknowledge-management-graphlocal-firstnote-managmentnote-takernote-takingnotebooknotesnotes-apppersonal-knowledge-basepersonal-wikiscriptableself-hostedself-hostingwiki
feat(share): improve error logging for missing templates
Elian Doran79dae44dbc55
diff --git a/apps/server/src/share/routes.ts b/apps/server/src/share/routes.tsindex 4d744ec5a7..752f8a6215 100644--- a/apps/server/src/share/routes.ts+++ b/apps/server/src/share/routes.ts@@ -16,6 +16,7 @@ import type SBranch from "./shaca/entities/sbranch.js";import type SAttachment from "./shaca/entities/sattachment.js";import utils, { isDev, safeExtractMessageAndStackFromError } from "../services/utils.js";import options from "../services/options.js";+import { t } from "i18next";function getSharedSubTreeRoot(note: SNote): { note?: SNote; branch?: SBranch } {if (note.noteId === shareRoot.SHARE_ROOT_NOTE_ID) {@@ -183,7 +184,7 @@ function register(router: Router) {// EJS caches the result of this so we don't need to pre-cacheconst includer = (path: string) => {const childNote = templateNote.children.find((n) => path === n.title);- if (!childNote) throw new Error("Unable to find child note.");+ if (!childNote) throw new Error(`Unable to find child note: ${path}.`);if (childNote.type !== "code" || childNote.mime !== "application/x-ejs") throw new Error("Incorrect child note type.");const template = childNote.getContent();