Skip to content

WASI preview 1 error handling #660

@divergentdave

Description

@divergentdave

I noticed that the code for the wasi_p1 backend now uses Error::from_neg_error_code(). WASI preview 1 error codes are unsigned 16-bit integers in the witx definition, though they are passed as signed 32-bit integers at the WASM level. The error values start at 1 and go up, so the code < 0 check transforms all errors into Error::UNEXPECTED. I confirmed this by calling getrandom from within a runtime that had a custom random_get import. I think this will need a separate constructor method, similar to Error::from_uefi_code().

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions