Stream: wit-bindgen

Topic: ✔ Problem returning a result


view this post on Zulip Christoph Brewing (Jun 29 2023 at 15:23):

Until recently, all of the functions in my world.wit returned something like

my-function: func(..) -> result<type>

, i.e. an "empty error", aka (). Technically, it works. However, since this is not very expressive, I changed the signature of one function to

my-function: func(..) -> result<type,string>

, i.e. returning a String in case of error. Host and (component) guest compile fine but whenever the host tries to load the corresponding component the following runtime error is thrown: failed to convert function my-function to given type.

The dependencies of the guest are wit-bindgen = "0.7.0".
The host uses wasmtime = { version = "10", features = ["component-model"] }.

Are there any known errors with result as return type?
Something else I might miss? Thank you for any hint!

view this post on Zulip Alex Crichton (Jun 29 2023 at 15:27):

I think this probably means that either the guest or the host is out of sync and one of them is still using result<type> for bindings rather than result<type, string>

view this post on Zulip Alex Crichton (Jun 29 2023 at 15:27):

so you may want to double-check that everything is using the latest definitions in the wit file

view this post on Zulip Christoph Brewing (Jun 29 2023 at 18:28):

Right, just did a cargo clean and currently recompiling .. let's see.

view this post on Zulip Christoph Brewing (Jun 29 2023 at 19:53):

Confirmed, the host used an outdated .wit :face_with_peeking_eye:

view this post on Zulip Notification Bot (Jun 29 2023 at 19:53):

Christoph Brewing has marked this topic as resolved.


Last updated: Dec 23 2024 at 12:05 UTC