Skip to content

Commit 65eb960

Browse files
cscheidgordonwoodhull
authored andcommitted
restore 1.7 behavior on pandoc failure
1 parent 59aee74 commit 65eb960

File tree

2 files changed

+9
-6
lines changed

2 files changed

+9
-6
lines changed

news/changelog-1.8.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
- ([#12657](https://github.com/quarto-dev/quarto-cli/pull/12657)): Load Giscus in generated script tag, to avoid wrong-theming in Chrome.
1717
- ([#12780](https://github.com/quarto-dev/quarto-cli/issues/12780)): `keep-ipynb: true` now works again correctly and intermediate `.quarto_ipynb` is not removed.
1818
- ([#13051](https://github.com/quarto-dev/quarto-cli/issues/13051)): Fixed support for captioned Markdown table inside Div syntax for crossref. This is special handling, but this could be output by function like `knitr::kable()` with old option support.
19+
- ([#13441](https://github.com/quarto-dev/quarto-cli/pull/13441)): Catch `undefined` exceptions in Pandoc failure to avoid spurious error message.
1920

2021
## Backwards-compatibility breaking changes
2122

src/command/render/render-files.ts

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -352,12 +352,13 @@ export async function renderFiles(
352352
return await pandocRenderer.onComplete(false, options.flags?.quiet);
353353
} catch (error) {
354354
if (!(error instanceof Error)) {
355-
warn("Should not have arrived here:", error);
356-
throw error;
355+
warn(`Error encountered when rendering files`);
357356
}
358357
return {
359358
files: (await pandocRenderer.onComplete(true)).files,
360-
error: error || new Error(),
359+
error: error instanceof Error
360+
? error
361+
: new Error(error ? String(error) : undefined),
361362
};
362363
} finally {
363364
tempContext.cleanup();
@@ -409,12 +410,13 @@ export async function renderFile(
409410
return await pandocRenderer.onComplete(false, options.flags?.quiet);
410411
} catch (error) {
411412
if (!(error instanceof Error)) {
412-
warn("Should not have arrived here:", error);
413-
throw error;
413+
warn(`Error encountered when rendering ${file.path}`);
414414
}
415415
return {
416416
files: (await pandocRenderer.onComplete(true)).files,
417-
error: error || new Error(),
417+
error: error instanceof Error
418+
? error
419+
: new Error(error ? String(error) : undefined),
418420
};
419421
} finally {
420422
if (Deno.env.get("QUARTO_PROFILER_OUTPUT")) {

0 commit comments

Comments
 (0)