Browse Source

Reference a missing filename when parsing modules (#6738)

Currently wasmtime's error message for `wasmtime nonexistent.wasm`
doesn't actually refer to `nonexistent.wasm` anywhere, so this commit
fills that in as contextual information on the returned error.
pull/6514/head
Alex Crichton 1 year ago
committed by GitHub
parent
commit
61a343bb33
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 4
      crates/wasmtime/src/module.rs

4
crates/wasmtime/src/module.rs

@ -235,9 +235,11 @@ impl Module {
#[cfg(any(feature = "cranelift", feature = "winch"))]
#[cfg_attr(nightlydoc, doc(cfg(any(feature = "cranelift", feature = "winch"))))]
pub fn from_file(engine: &Engine, file: impl AsRef<Path>) -> Result<Module> {
let file = file.as_ref();
match Self::new(
engine,
&fs::read(&file).with_context(|| "failed to read input file")?,
&fs::read(file)
.with_context(|| format!("failed to read input file: {}", file.display()))?,
) {
Ok(m) => Ok(m),
Err(e) => {

Loading…
Cancel
Save