Fix stale presenter after expected operation errors (#2589)

Co-authored-by: GCHQDeveloper581 <63102987+GCHQDeveloper581@users.noreply.github.com> (tweaked tests)
This commit is contained in:
Zain Nadeem 2026-06-24 21:39:01 +05:00 committed by GitHub
parent 9f87fec52d
commit 0e50d32ec5
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 20 additions and 0 deletions

View File

@ -241,9 +241,11 @@ class Recipe {
// Cannot rely on `err instanceof OperationError` here as extending
// native types is not fully supported yet.
dish.set(err.message, "string");
this.lastRunOp = null;
return i;
} else if (err instanceof DishError || err?.type === "DishError") {
dish.set(err.message, "string");
this.lastRunOp = null;
return i;
} else {
const e = typeof err == "string" ? { message: err } : err;

View File

@ -7,6 +7,9 @@
import TestRegister from "../../lib/TestRegister.mjs";
const oversizedPdfLikeInput = "%PDF-1.0\n" + "A".repeat(5000);
TestRegister.addTests([
{
name: "RenderPDF",
@ -34,4 +37,19 @@ TestRegister.addTests([
}
],
},
{
name: "RenderPDF followed by Generate QR Code error returns plain text",
input: oversizedPdfLikeInput,
expectedOutput: "Error generating QR code. (Error: Too much data)",
recipeConfig: [
{
"op": "Render PDF",
"args": ["Raw"]
},
{
"op": "Generate QR Code",
"args": ["PNG", 1, 0, "High"]
}
],
},
]);