-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(wasmtime): add error hint for missing WASI imports #10259
base: main
Are you sure you want to change the base?
feat(wasmtime): add error hint for missing WASI imports #10259
Conversation
This commit adds some code to print an error hint when a failed `wasmtime run` command could have been called with arguments (in particular `-S <capability>`) that would have enabled the command to succeed. Signed-off-by: Victor Adossi <[email protected]>
fadc897
to
51d8d52
Compare
Personally I'm always a fan of improving error messages, so overall seems like a good idea. For the specifics though I'd prefer to try to get more structured data here as opposed to having stringly-typed error messages with string searching for when to print an error. For example we could add a dedicated error type which indicates exactly which import was not found (e.g. Using Basically I think it'll be unfortunately pretty nontrivial to present a good error message here, so to improve things it's probably necessary to accept false positives/negatives for the time being. |
Yeah I definitely agree that it'd be better to have a structured error here -- given that we don't yet have a unified way to parse/represent the text of an import name (AFAIK, outside a
Yeah what do you think would be a good way to proceed here? To just print the message regardless of error contents, maybe as a general |
A possible idea:
That's a little involved but in theory should be pretty robust in the face adding/removing methods over time and such. It'd also handle the case of something like |
This commit adds some code to print an error hint when a failed
wasmtime run
command could have been called with arguments (in particular-S <capability>
) that would have enabled the command to succeed.Output looks like this, when running a module that imports
wasi:http
:There are a few bits left to figure out (ex. seems like wit-parser doesn't yet have any shared/reusable relatively simple function for parsing import names into constituent parts?), but wanted to put up a draft to get some feedback, and make sure this is even desirable for maintainers.