Skip to content

Commit

Permalink
Reference a missing filename when parsing modules (bytecodealliance#6738
Browse files Browse the repository at this point in the history
)

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.
  • Loading branch information
alexcrichton committed Jul 17, 2023
1 parent cc6f9d0 commit 61a343b
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion crates/wasmtime/src/module.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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) => {
Expand Down

0 comments on commit 61a343b

Please sign in to comment.