WebAssembly / WebAssembly/spec
[js-api] Is the exception propagation model used consistently?
Nobody has claimed this yet.
- Dominant language
- WebAssembly
- Stars
- 3.5k
- Forks
- 539
- Avg merge
- 2d 1h
- Merged PRs (30d)
- 13
Description
I may be misunderstanding the intended exception mechanism in the WebAssembly JS API (WJI) specification, and I’d like to confirm whether my reading is correct.
Section 3 “Notation” states that the specification depends on the Infra Standard.
In Infra, when an algorithm throws, the caller automatically rethrows the exception unless the caller explicitly catches it in prose.
Additionally, many algorithms in this document are written using ECMAScript abstract operations and conventions (e.g., Completion Records and the ? shorthand), where a throw is represented as returning a throw completion and propagation is explicit at the call site.
From this, my understanding is that the document currently appears to both propagation conventions: Infra’s automatic rethrow and ECMAScript’s explicit, completion-based propagation.
As an illustrative example, in “run a host function”, step 8 uses the ECMAScript form ? ToWebAssemblyValue(ret, results[0]), whereas step 9.6.1 calls ToWebAssemblyValue(value, resultType) without ?, which reads as Infra-style.
Is this understanding correct?
If so, I would appreciate discussing how this could be reflected or clarified consistently in the spec text.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reading Section 3 “Notation” in the WebAssembly JS API specification, then compare the exception conventions in “run a host function,” especially step 8 and step 9.6.1. Determine whether the two propagation styles are inconsistent and what clarification the specification text would need.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- wasm
- Domain
- documentation
- Issue type
- Documentation
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100