Conversation
Wasmtime 42.0 introduces its own Error/Result types separate from anyhow. Key changes: - Enable `anyhow` feature and `anyhow: true` in bindgen! to keep using anyhow::Result in generated trait impls - Remove Config::async_support() call (no longer needed in 42.0) - Convert wasmtime::Result to anyhow::Result in trait implementations - Add explicit error conversions in worker.rs where wasmtime::Error needs to interop with anyhow::Error https://claude.ai/code/session_017QXVDsinAdu6SjX7QZPZ26
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR updates the plugin implementations to use
anyhow::Resultinstead ofwasmtime::Resultfor their host function return types. This change improves error handling consistency across the codebase by using the standardanyhowerror type throughout.Key Changes
HostTypeInfoandHostValuetrait implementations to returnanyhow::Resultinstead ofwasmtime::Result(~180 method signatures)anyhow::ResultHostHttpError2andHostHttpRequest2trait implementations to returnanyhow::Resultanyhow::ResultResourcestrait methods (get,get_mut,get_txn) to returnanyhow::Resultanyhow: trueto thebindgen!macro configuration inlib.rsto enable anyhow supportconfig.async_support(true)call fromWorkerBuilderas it's no longer neededImplementation Details
The change leverages the
anyhowcrate's integration with wasmtime's component model, allowing host functions to returnanyhow::Resultwhich is automatically converted to the appropriate trap/error representation. This provides better error context and consistency with the rest of the codebase's error handling patterns.https://claude.ai/code/session_017QXVDsinAdu6SjX7QZPZ26