Skip to content

Update to wasmtime 42#99

Merged
swlynch99 merged 2 commits intomainfrom
claude/update-wasmtime-GidwK
Mar 16, 2026
Merged

Update to wasmtime 42#99
swlynch99 merged 2 commits intomainfrom
claude/update-wasmtime-GidwK

Conversation

@swlynch99
Copy link
Copy Markdown
Contributor

This PR updates the plugin implementations to use anyhow::Result instead of wasmtime::Result for their host function return types. This change improves error handling consistency across the codebase by using the standard anyhow error type throughout.

Key Changes

  • SQL Plugin: Updated all HostTypeInfo and HostValue trait implementations to return anyhow::Result instead of wasmtime::Result (~180 method signatures)
  • WASI Plugins: Updated filesystem, I/O, CLI, clocks, and random implementations to use anyhow::Result
  • HTTP Plugin: Updated HostHttpError2 and HostHttpRequest2 trait implementations to return anyhow::Result
  • Notify Plugin: Updated notification blocking methods to return anyhow::Result
  • Resource Management: Updated Resources trait methods (get, get_mut, get_txn) to return anyhow::Result
  • Bindgen Configuration: Added anyhow: true to the bindgen! macro configuration in lib.rs to enable anyhow support
  • Worker Configuration: Removed the config.async_support(true) call from WorkerBuilder as it's no longer needed

Implementation Details

The change leverages the anyhow crate's integration with wasmtime's component model, allowing host functions to return anyhow::Result which 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

claude added 2 commits March 16, 2026 19:16
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
@swlynch99 swlynch99 merged commit cd806bc into main Mar 16, 2026
7 checks passed
@swlynch99 swlynch99 deleted the claude/update-wasmtime-GidwK branch March 16, 2026 19:43
@swlynch99 swlynch99 changed the title Replace wasmtime::Result with anyhow::Result in plugin implementations Update to wasmtime 42 Mar 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants