lunatic-solutions / lunatic

Lunatic is an Erlang-inspired runtime for WebAssembly
https://lunatic.solutions
Apache License 2.0
4.57k stars 136 forks source link

Improve error message when wasm module is not found #180

Closed tqwewe closed 1 year ago

tqwewe commented 1 year ago

I was coming across an issue when trying to run my wasm module where I got an error:

cargo run --example spawn_macro Running lunatic run target/wasm32-wasi/debug/app.wasm Error: No such file or directory (os error 2)

This led me to believe that my program was trying to open a file and it was not able to find it. But in reality the issue is a confusion around the new lunatic run command, and I was using an older version where lunatic was trying to run a module called run.

For this reason, it might be better to add a better error message when the lunatic run command cannot find the wasm module. For example:

lunatic run foo.wasm Error: Module 'run' does not exist

For comparison, when you try to run an elixir file that doesn't exist, elixir outputs this:

❯ elixir foo.exs No file named foo.exs