Open yamt opened 4 months ago
Usually one can encode such checks in Wasm itself with some wrapper function, but the start function is an interesting exception.
An assert_exception might make sense, the only problem is that there is no obvious way to refer to a specific exception, i.e., a tag, outside of a module. We could have an assertion that cannot check the exception, but that seems a bit half-arsed. Perhaps the tag would have to be identified by a module + export name?
Strawman:
(assert_exception
where the values are the exception's expected payload.
But can such an assertion always be translated to JS easily, e.g., if the exception carries a v128? In the case of call results, the interpreter's JS translation synthesises a Wasm wrapper performing the check in such cases, but for exceptions that's a bit more more work and won't directly extend to the implicit invocation of the start function. It would at least require some extra indirection bouncing back between Wasm and JS to wrap a Wasm handler around module instantiation.
maybe we need to add assert_exception for a module?