Skip to content

[js-api] Is the exception propagation model used consistently? #2040

@ShinWonho

Description

@ShinWonho

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions