Skip to content

Comments

fix: propagate BPMN render failures from browser to Node in diagram rendering#81

Draft
Copilot wants to merge 2 commits intofeat/process-instance-diagramfrom
copilot/sub-pr-60-again
Draft

fix: propagate BPMN render failures from browser to Node in diagram rendering#81
Copilot wants to merge 2 commits intofeat/process-instance-diagramfrom
copilot/sub-pr-60-again

Conversation

Copy link
Contributor

Copilot AI commented Feb 23, 2026

The browser-side renderer was setting window.__diagramRendered = true in both success and catch paths, causing Puppeteer to take a blank screenshot on render failure and the CLI to report success.

Changes

  • Browser (HTML template): Catch block now sets window.__diagramError with the error message instead of window.__diagramRendered = true
  • Node/Puppeteer: waitForFunction resolves on either __diagramRendered (success) or __diagramError (failure); if the latter is set, throws back to the caller
// Browser: catch block now signals error instead of success
window.__diagramError = err instanceof Error ? err.message : String(err);

// Node: waitForFunction resolves on either outcome
await page.waitForFunction(
  'window.__diagramRendered === true || window.__diagramError !== undefined',
  { timeout: 15000 },
);

// Node: propagate render error
const renderError = await page.evaluate('window.__diagramError');
if (renderError) {
  throw new Error(`BPMN diagram render failed: ${renderError}`);
}

💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

In the HTML template catch block, set window.__diagramError with the
error message instead of window.__diagramRendered = true. In the
Puppeteer waitForFunction, also wait on window.__diagramError !== undefined.
After waitForFunction, read window.__diagramError and throw if set,
propagating the render failure back to Node so the CLI fails correctly.

Co-authored-by: vobu <6573426+vobu@users.noreply.github.com>
Copilot AI changed the title [WIP] WIP to address feedback on render PI diagram PR fix: propagate BPMN render failures from browser to Node in diagram rendering Feb 23, 2026
Copilot AI requested a review from vobu February 23, 2026 12:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants