Skip to content

Commit df9c437

Browse files
claude: Fix stack trace shown for Typst compilation errors
Use ErrorEx with printStack=false so users see only the Typst error message without a confusing internal stack trace. Fixes #13942 Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
1 parent bd49015 commit df9c437

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

news/changelog-1.9.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ All changes included in 1.9:
5353
- Two-column layout now uses `set page(columns:)` instead of `columns()` function, fixing compatibility with landscape sections.
5454
- Title block now properly spans both columns in multi-column layouts.
5555
- ([#13870](https://github.com/quarto-dev/quarto-cli/issues/13870)): Add support for `alt` attribute on cross-referenced equations for improved accessibility. (author: @mcanouil)
56+
- ([#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.
5657

5758
### `pdf`
5859

src/command/render/output-typst.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ import {
2727
kVariant,
2828
} from "../../config/constants.ts";
2929
import { error, warning } from "../../deno_ral/log.ts";
30+
import { ErrorEx } from "../../core/lib/error.ts";
3031
import { Format } from "../../config/types.ts";
3132
import { writeFileToStdout } from "../../core/console.ts";
3233
import { dirAndStem, expandPath } from "../../core/path.ts";
@@ -161,11 +162,10 @@ export function typstPdfOutputRecipe(
161162
typstOptions,
162163
);
163164
if (!result.success) {
164-
// Log the error so test framework can detect it via shouldError
165165
if (result.stderr) {
166166
error(result.stderr);
167167
}
168-
throw new Error("Typst compilation failed");
168+
throw new ErrorEx("Error", "Typst compilation failed", false, false);
169169
}
170170

171171
// Validate PDF against specified standards using verapdf (if available)

0 commit comments

Comments
 (0)