wasi-common: instead of panicking, use an Error::Unsupported that Traps

This commit is contained in:
Pat Hickey
2021-01-07 14:05:49 -08:00
parent 030f01345a
commit b149a03d5d
5 changed files with 59 additions and 49 deletions

View File

@@ -117,7 +117,7 @@ fn handle_fd_event(
let output_event = if revents.contains(PollFlags::POLLNVAL) {
Event {
userdata: fd_event.userdata,
error: Error::Badf.into(),
error: Error::Badf.try_into().unwrap(),
type_: fd_event.r#type,
fd_readwrite: EventFdReadwrite {
nbytes: 0,
@@ -127,7 +127,7 @@ fn handle_fd_event(
} else if revents.contains(PollFlags::POLLERR) {
Event {
userdata: fd_event.userdata,
error: Error::Io.into(),
error: Error::Io.try_into().unwrap(),
type_: fd_event.r#type,
fd_readwrite: EventFdReadwrite {
nbytes: 0,