Skip to content

fix: ensure WebGL→WASM fallback catches synchronous throws#86

Merged
devlux76 merged 2 commits intorefactor/lib-ui-structurefrom
copilot/sub-pr-85
Mar 14, 2026
Merged

fix: ensure WebGL→WASM fallback catches synchronous throws#86
devlux76 merged 2 commits intorefactor/lib-ui-structurefrom
copilot/sub-pr-85

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Mar 14, 2026

Promise.resolve(WebGlVectorBackend.create()) evaluates create() synchronously before the promise is constructed — a synchronous throw escapes the promise chain entirely, making the .catch() WASM fallback dead code.

Change

Wrap the call in .then() so any synchronous throw is captured as a rejection:

// Before — synchronous throw bypasses .catch()
return Promise.resolve(WebGlVectorBackend.create()).catch(() =>
  WasmVectorBackend.create(wasmBytes)
);

// After — throw is converted to a rejected promise, fallback fires correctly
return Promise.resolve()
  .then(() => WebGlVectorBackend.create())
  .catch(() => WasmVectorBackend.create(wasmBytes));

This aligns the WebGL path with how the WebGPU and WebNN paths already handle async creation and fallback.


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

…us throws for WASM fallback

Co-authored-by: devlux76 <86517969+devlux76@users.noreply.github.com>
Copilot AI changed the title [WIP] [WIP] Address feedback from review on core engine and harness refactor fix: ensure WebGL→WASM fallback catches synchronous throws Mar 14, 2026
Copilot AI requested a review from devlux76 March 14, 2026 09:29
@devlux76 devlux76 marked this pull request as ready for review March 14, 2026 09:33
Copilot AI review requested due to automatic review settings March 14, 2026 09:33
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Fixes the WebGL→WASM fallback in createVectorBackend so that a synchronous throw from WebGlVectorBackend.create() is properly caught and triggers the WASM fallback, rather than escaping the promise chain.

Changes:

  • Wraps WebGlVectorBackend.create() inside .then() instead of passing it directly to Promise.resolve(), ensuring synchronous throws become promise rejections.

@devlux76 devlux76 merged commit 003ccad into refactor/lib-ui-structure Mar 14, 2026
5 of 7 checks passed
@devlux76 devlux76 deleted the copilot/sub-pr-85 branch March 14, 2026 09:35
devlux76 added a commit that referenced this pull request Mar 14, 2026
* refactor: move core engine code into lib/ and runtime harness into ui/

* fix: update test results to reflect failure status and record failed test IDs

* fix: add unzip package to Dockerfile dependencies

* fix: ensure WebGL→WASM fallback catches synchronous throws (#86)

* Initial plan

* fix: wrap WebGlVectorBackend.create() in .then() to capture synchronous throws for WASM fallback

Co-authored-by: devlux76 <86517969+devlux76@users.noreply.github.com>

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: devlux76 <86517969+devlux76@users.noreply.github.com>

---------

Co-authored-by: Copilot <198982749+Copilot@users.noreply.github.com>
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.

3 participants