Skip to content

exceptions proposal not enabled #1257

@rioam2

Description

@rioam2

I am beginning to experiment a bit with the new exceptions proposal, and built a component using wit-bindgen@0.43.0 and the upcoming wasi-sdk changes with exception handling: WebAssembly/wasi-sdk#590.

Unfortunately, when transpiling this module to JS+TS using jco, I get the following error:

file:///.../node_modules/@bytecodealliance/jco/obj/js-component-bindgen-component.js:4769
    throw new ComponentError(retCopy.val);
          ^

ComponentError: failed to translate component

Caused by:
    exceptions proposal not enabled (at offset 0x5082)
    at generate (file:///.../node_modules/@bytecodealliance/jco/obj/js-component-bindgen-component.js:4769:11)
    at transpileComponent (file:///.../node_modules/@bytecodealliance/jco/src/cmd/transpile.js:197:39)
    at async file:///.../scripts/transpile_component.js:43:16

Node.js v20.11.1

Looking at the source code in this repo, it looks like feature proposal support is enabled within the js-component-bindgen-component crate, and more specifically with wasmparser:

let mut validator = wasmtime_environ::wasmparser::Validator::new_with_features(
WasmFeatures::WASM2
| WasmFeatures::COMPONENT_MODEL
| WasmFeatures::CM_ASYNC
| WasmFeatures::CM_ASYNC_BUILTINS
| WasmFeatures::CM_ASYNC_STACKFUL
| WasmFeatures::CM_ERROR_CONTEXT
| WasmFeatures::EXTENDED_CONST
| WasmFeatures::MEMORY64
| WasmFeatures::MULTI_MEMORY,
);

Would it be reasonable to add feature support for Exceptions using wasmparser's WasmFeatures::EXCEPTIONS constant? (ref)?

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