bytecodealliance / preview2-prototyping

Polyfill adapter for preview1-using wasm modules to call preview2 functions.
Other
77 stars 20 forks source link

wasi-common: Table operations return a distinct TableError enum #164

Closed pchickey closed 1 year ago

pchickey commented 1 year ago

The wasi-common::Error enum is actually specific to the filesystem. Table operations (which get used by other crates now) have only three error cases:

This change makes it possible for these error cases to be translated to whatever error value or trap is appropriate at the use site.

In wasi-common filesystem, I provided the old translation - trap when full, badf otherwise.

In wasi-common streams, we trap when full, and return the empty stream error type otherwise. That type still needs fleshing out in the wit definition.

In wasi-sockets, we always trap, because the error cases there are also not fleshed out, and also trappable errors are broken in sockets (see #163 )