-
Notifications
You must be signed in to change notification settings - Fork 261
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
Improve error messages for the asserts in the various tools #1996
Comments
In theory asserts should never happen and they're only intended for developers of the tool itself, any other error should be signaled through a Although naturally internal assertions do trip (e.g. this) and I don't disagree that having better error messages would be helpful. That being said though I wouldn't want to improve things to expect all users to see them because the true bug is having this trip at all. |
The mis-configuration came from using the macro in a way that was intended for testing purposes only (https://docs.rs/wit-bindgen/latest/wit_bindgen/macro.generate.html#options-to-generate)
The configuration was bringing in two references to the wasi-io: wit_bindgen::generate!({
inline: "
package wasmtime:test;
world test {
include wasi:cli/[email protected];
include wasi:http/[email protected];
include wasi:config/[email protected];
include wasi:keyvalue/[email protected];
include wasi:tls/[email protected]; #added line
}
",
path: [
"../wasi-http/wit", // this also has a deps folder to io
"../wasi-config/wit",
"../wasi-keyvalue/wit",
"../wasi-tls/wit/", // this has a deps folder to io
],
world: "wasmtime:test/test",
features: ["cli-exit-with-code", "tls"],
generate_all,
}); The two wasi-io deps collided with the error "prev.is_none()`. Technically I guess this is an error and not an assert? |
Oh dear that looks like something that should be expected to work. That documentation is a bit outdated and the array-of-paths situation is a bit more expected to work nowadays as well. Would you be able to make a reproduction? If it's still using wit-bindgen that's ok, I can work on reducing it as a reproduction for this repository. |
I believe this is a simplified reproduction: https://github.com/jsturtevant/wasi-cli/tree/prev-is-none I am getting:
I wasn't able to figure out how to load multiple deps via just the |
I mis-configured wit-bingen macro and got the error message:
When trying to debug it I tried using
cargo expand
andcargo docs
to track down what I did wrong but the gave the same error.After some digging and forking the various repositories, I eventually tracked the error message to this repo which has a bunch of asserts: https://github.com/search?q=repo%3Abytecodealliance%2Fwasm-tools%20%20prev.is_none&type=code
As a developer it would be nice to have a better error message for these asserts to improve the debugging experience.
The text was updated successfully, but these errors were encountered: