Allow wasm embedders to reject wasm modules with unsupported features. (#345)
Define `WasmError` (and an accompanying `WasmResult`) to represent errors translating WebAssembly functions. Make `translate_call` and related functions return `WasmResult`s so that embedders have the flexibility to reject features they don't support. Move `InvalidInput` out of `CtonError` and into `WasmError`, where it's now named `InvalidWebAssembly`, as it's a WebAssembly-specific error condition. Also extend it to preserve the original error message and bytecode offset.
This commit is contained in:
@@ -105,7 +105,9 @@ fn handle_module(
|
||||
}
|
||||
|
||||
let mut dummy_environ = DummyEnvironment::with_flags(fisa.flags.clone());
|
||||
translate_module(&data, &mut dummy_environ)?;
|
||||
translate_module(&data, &mut dummy_environ).map_err(
|
||||
|e| e.to_string(),
|
||||
)?;
|
||||
|
||||
terminal.fg(term::color::GREEN).unwrap();
|
||||
vprintln!(flag_verbose, "ok");
|
||||
|
||||
Reference in New Issue
Block a user