Skip to content

Commit 0e50d32

Browse files
Fix stale presenter after expected operation errors (#2589)
Co-authored-by: GCHQDeveloper581 <63102987+GCHQDeveloper581@users.noreply.github.com> (tweaked tests)
1 parent 9f87fec commit 0e50d32

2 files changed

Lines changed: 20 additions & 0 deletions

File tree

src/core/Recipe.mjs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -241,9 +241,11 @@ class Recipe {
241241
// Cannot rely on `err instanceof OperationError` here as extending
242242
// native types is not fully supported yet.
243243
dish.set(err.message, "string");
244+
this.lastRunOp = null;
244245
return i;
245246
} else if (err instanceof DishError || err?.type === "DishError") {
246247
dish.set(err.message, "string");
248+
this.lastRunOp = null;
247249
return i;
248250
} else {
249251
const e = typeof err == "string" ? { message: err } : err;

tests/operations/tests/RenderPDF.mjs

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@
77
import TestRegister from "../../lib/TestRegister.mjs";
88

99

10+
const oversizedPdfLikeInput = "%PDF-1.0\n" + "A".repeat(5000);
11+
12+
1013
TestRegister.addTests([
1114
{
1215
name: "RenderPDF",
@@ -34,4 +37,19 @@ TestRegister.addTests([
3437
}
3538
],
3639
},
40+
{
41+
name: "RenderPDF followed by Generate QR Code error returns plain text",
42+
input: oversizedPdfLikeInput,
43+
expectedOutput: "Error generating QR code. (Error: Too much data)",
44+
recipeConfig: [
45+
{
46+
"op": "Render PDF",
47+
"args": ["Raw"]
48+
},
49+
{
50+
"op": "Generate QR Code",
51+
"args": ["PNG", 1, 0, "High"]
52+
}
53+
],
54+
},
3755
]);

0 commit comments

Comments
 (0)