mirror of
https://github.com/TriliumNext/Notes.git
synced 2025-07-28 18:42:28 +08:00
feat(share): improve error logging for missing templates
This commit is contained in:
parent
b81be8f8d7
commit
79dae44dbc
@ -16,6 +16,7 @@ import type SBranch from "./shaca/entities/sbranch.js";
|
|||||||
import type SAttachment from "./shaca/entities/sattachment.js";
|
import type SAttachment from "./shaca/entities/sattachment.js";
|
||||||
import utils, { isDev, safeExtractMessageAndStackFromError } from "../services/utils.js";
|
import utils, { isDev, safeExtractMessageAndStackFromError } from "../services/utils.js";
|
||||||
import options from "../services/options.js";
|
import options from "../services/options.js";
|
||||||
|
import { t } from "i18next";
|
||||||
|
|
||||||
function getSharedSubTreeRoot(note: SNote): { note?: SNote; branch?: SBranch } {
|
function getSharedSubTreeRoot(note: SNote): { note?: SNote; branch?: SBranch } {
|
||||||
if (note.noteId === shareRoot.SHARE_ROOT_NOTE_ID) {
|
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-cache
|
// EJS caches the result of this so we don't need to pre-cache
|
||||||
const includer = (path: string) => {
|
const includer = (path: string) => {
|
||||||
const childNote = templateNote.children.find((n) => path === n.title);
|
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.");
|
if (childNote.type !== "code" || childNote.mime !== "application/x-ejs") throw new Error("Incorrect child note type.");
|
||||||
|
|
||||||
const template = childNote.getContent();
|
const template = childNote.getContent();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user