Stream: git-wasmtime

Topic: wasmtime / PR #4161 Tweak CLI fallback to the `run` command


view this post on Zulip Wasmtime GitHub notifications bot (May 18 2022 at 17:50):

alexcrichton opened PR #4161 from better-cli-error to main:

I ran across a case in Wasmtime today where a poor error message came
out of the CLI. For example before this commit you would get:

$ cargo run wast --wasm-features component-model foo.wast
error: Invalid value "wast" for '<MODULE>': module name cannot be the same as a subcommand

and now after this commit you get:

$ cargo run wast --wasm-features component-model foo.wast
error: Invalid value "component-model" for '--wasm-features <FEATURE,FEATURE,...>': unsupported WebAssembly feature 'component-model'

I believe this was an accidental regression from #4082 since Wasmtime
0.36.0 produces the error message as expected.

I opted to invert the conditional logic for falling back to the run
subcommand. Instead of having a small set of error kinds that print the
first-level error a small set of error kinds are now used to fall back
to the run subcommand by default. My hope is that as ErrorKind is
extended over time with various sorts of errors of parsing argumenst
this'll be more robust because most of the time we want the CLI
invocation to print out the normal CLI error, it's only in a select few
cases that using run is likely to succeed.

<!--

Please ensure that the following steps are all taken care of before submitting
the PR.

Please ensure all communication adheres to the code of conduct.
-->

view this post on Zulip Wasmtime GitHub notifications bot (May 18 2022 at 18:20):

peterhuene submitted PR review.

view this post on Zulip Wasmtime GitHub notifications bot (May 18 2022 at 20:30):

alexcrichton merged PR #4161.


Last updated: Nov 22 2024 at 16:03 UTC