Skip to content

Commit 3569878

Browse files
Brandon Huntclaude
authored andcommitted
feat(pdf-engine): add success and error notices with console logging (#22)
- Success notice shows file path and auto-dismisses after 5 seconds - Error notice persists until dismissed (timeout: 0) - console.error prefixed with [Obsidian Typeset] for easy console filtering Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent 1e2051a commit 3569878

1 file changed

Lines changed: 4 additions & 3 deletions

File tree

src/pdf-exporter.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,7 @@ export class PdfExporter {
139139
if (appContainer) appContainer.style.display = "none";
140140

141141
try {
142+
throw new Error("Test error"); // ← add this
142143
// ------------------------------------------------------------------
143144
// Step 4: Call printToPDF on the current Obsidian window.
144145
// We access Electron via require() — no new window needed.
@@ -175,12 +176,12 @@ export class PdfExporter {
175176
const vaultPath = (this.app.vault.adapter as any).basePath as string;
176177
writeFileSync(join(vaultPath, outputPath), pdfBuffer);
177178

178-
new Notice(`PDF saved: ${outputPath}`);
179+
new Notice(`PDF saved to: ${outputPath}`, 5000);
179180
console.log(`Typeset: PDF exported to "${outputPath}"`);
180181

181182
} catch (err) {
182-
new Notice("PDF export failed. Check the console for details.");
183-
console.error("Typeset: PDF export error", err);
183+
new Notice("Export failed — check the developer console for details.", 0);
184+
console.error("[Obsidian Typeset] Export failed:", err);
184185
} finally {
185186
// Always restore Obsidian's UI and remove injected elements
186187
if (appContainer) appContainer.style.display = "";

0 commit comments

Comments
 (0)