diff --git a/news/changelog-1.9.md b/news/changelog-1.9.md index 1a6e122281..886e181b4c 100644 --- a/news/changelog-1.9.md +++ b/news/changelog-1.9.md @@ -53,6 +53,7 @@ All changes included in 1.9: - Two-column layout now uses `set page(columns:)` instead of `columns()` function, fixing compatibility with landscape sections. - Title block now properly spans both columns in multi-column layouts. - ([#13870](https://github.com/quarto-dev/quarto-cli/issues/13870)): Add support for `alt` attribute on cross-referenced equations for improved accessibility. (author: @mcanouil) +- ([#13942](https://github.com/quarto-dev/quarto-cli/issues/13942)): Fix Typst compilation errors showing confusing internal stack traces. Users now see only the relevant Typst error message. ### `pdf` diff --git a/src/command/render/output-typst.ts b/src/command/render/output-typst.ts index 695a144a8f..58352b8212 100644 --- a/src/command/render/output-typst.ts +++ b/src/command/render/output-typst.ts @@ -27,6 +27,7 @@ import { kVariant, } from "../../config/constants.ts"; import { error, warning } from "../../deno_ral/log.ts"; +import { ErrorEx } from "../../core/lib/error.ts"; import { Format } from "../../config/types.ts"; import { writeFileToStdout } from "../../core/console.ts"; import { dirAndStem, expandPath } from "../../core/path.ts"; @@ -161,11 +162,10 @@ export function typstPdfOutputRecipe( typstOptions, ); if (!result.success) { - // Log the error so test framework can detect it via shouldError if (result.stderr) { error(result.stderr); } - throw new Error("Typst compilation failed"); + throw new ErrorEx("Error", "Typst compilation failed", false, false); } // Validate PDF against specified standards using verapdf (if available) diff --git a/tests/smoke/smoke-all.test.ts b/tests/smoke/smoke-all.test.ts index b209c2a631..9b85314d23 100644 --- a/tests/smoke/smoke-all.test.ts +++ b/tests/smoke/smoke-all.test.ts @@ -263,7 +263,11 @@ function resolveTestSpecs( verifyFns.push(verifyMap[key](outputFile.outputPath, ...value)); } } else if (key === "printsMessage") { - verifyFns.push(verifyMap[key](value)); + // Support both single object and array of printsMessage checks + const messages = Array.isArray(value) ? value : [value]; + for (const msg of messages) { + verifyFns.push(verifyMap[key](msg)); + } } else if (key === "ensureEpubFileRegexMatches") { // this ensure function is special because it takes an array of path + regex specifiers, // so we should never use the spread operator