Skip to content

Commit

Permalink
feat(renderer): Inject error message into failed document.
Browse files Browse the repository at this point in the history
  • Loading branch information
walkthunder committed Oct 18, 2023
1 parent 5008a22 commit 83e90c6
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions src/html-generation/markdown-renderer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ export namespace MarkdownRenderer
// RenderLog.warning("Cannot render file: ", message);
view?.warn(`Cannot render file: ${message}`);
view?.update(file.markdownFile.path, { syncStatus: 'fail' })
return generateFailDocument();
return generateFailDocument(`Render Failed: ${message}`);
}

if (cancelled) throw new Error("Markdown rendering cancelled");
Expand All @@ -44,7 +44,7 @@ export namespace MarkdownRenderer
// RenderLog.warning("Cannot render file: ", message);
view?.warn(`Cannot render file: ${message}`);
view?.update(file.markdownFile.path, { syncStatus: 'fail' })
return generateFailDocument();
return generateFailDocument(`Render Failed: ${message}`);
}

// @ts-ignore
Expand All @@ -58,7 +58,7 @@ export namespace MarkdownRenderer
// RenderLog.warning("Cannot render file: ", message);
view?.warn(`Cannot render file: ${message}`);
view?.update(file.markdownFile.path, { syncStatus: 'fail' })
return generateFailDocument();
return generateFailDocument(`Render Failed: ${message}`);
}

const preview = renderLeaf.view.previewMode;
Expand Down Expand Up @@ -91,11 +91,10 @@ export namespace MarkdownRenderer

if (!renderfinished)
{
const message = "Failed to render file within 30 seconds! File: " + file.markdownFile.path;
// RenderLog.warning("Cannot render file: ", message);
view?.warn(`Cannot render file: ${message}`);
const message = "Network Error: Failed to render file within 30 seconds! File " + file.markdownFile.path;
view?.warn(message);
view?.update(file.markdownFile.path, { syncStatus: 'fail' })
return generateFailDocument();
return generateFailDocument(message);
}

// wait for dataview blocks to render
Expand Down Expand Up @@ -124,7 +123,7 @@ export namespace MarkdownRenderer
const message = "Could not find container with rendered content! File: " + file.markdownFile.path;
// RenderLog.warning("Cannot render file: ", message);
view?.warn(`Cannot render file: ${message}`);
return generateFailDocument();
return generateFailDocument(message);
}

function postProcessHTML(file: ExportFile, html: HTMLElement)
Expand Down

0 comments on commit 83e90c6

Please sign in to comment.