Skip to content
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

Return errors as records, not resources #75

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Commits on Jul 31, 2024

  1. Return errors as records, not resources

    This change migrates the `error` type to return as a record instead of a
    resource. The previous logic behind WebAssembly#64, IIRC, is that users that may
    not wish to copy the potentially-large `data` string across the
    canonical ABI would not have to--they could call the `data` method on
    the resource if they really needed it.
    
    Technical complexity during implementation is making me reconsider this
    decision. While implementing this in Wasmtime, I realized that after an
    error happens, the current "error as resource" scheme results in a
    multi-step failure algorithm:
    - construct the internal host error
    - register the host error in the resource table--this may fail!
    - return the host error as a resource
    
    This complexity does not mean necessarily that the spec _must_ be
    changed; I believe there is a way to "make it work." But if users end up
    troubleshooting a resource failure that happens during a wasi-nn
    failure, we risk making things a bit too complex for them. And, if
    indeed the original argument for using resources was avoiding
    performance overhead, there is a case to be made that in failure modes
    performance is not the most critical for users.
    
    I'll open this seeking feedback, not to merge immediately.
    abrown committed Jul 31, 2024
    Configuration menu
    Copy the full SHA
    22e4af8 View commit details
    Browse the repository at this point in the history