wasi-common: instead of panicking, use an Error::Unsupported that Traps
This commit is contained in:
@@ -724,7 +724,7 @@ impl<'a> WasiSnapshotPreview1 for WasiCtx {
|
||||
}
|
||||
|
||||
fn proc_raise(&self, _sig: types::Signal) -> Result<()> {
|
||||
unimplemented!("proc_raise")
|
||||
Err(Error::Unsupported("proc_raise"))
|
||||
}
|
||||
|
||||
fn sched_yield(&self) -> Result<()> {
|
||||
@@ -744,7 +744,7 @@ impl<'a> WasiSnapshotPreview1 for WasiCtx {
|
||||
_ri_data: &types::IovecArray<'_>,
|
||||
_ri_flags: types::Riflags,
|
||||
) -> Result<(types::Size, types::Roflags)> {
|
||||
unimplemented!("sock_recv")
|
||||
Err(Error::Unsupported("sock_recv"))
|
||||
}
|
||||
|
||||
fn sock_send(
|
||||
@@ -753,11 +753,11 @@ impl<'a> WasiSnapshotPreview1 for WasiCtx {
|
||||
_si_data: &types::CiovecArray<'_>,
|
||||
_si_flags: types::Siflags,
|
||||
) -> Result<types::Size> {
|
||||
unimplemented!("sock_send")
|
||||
Err(Error::Unsupported("sock_send"))
|
||||
}
|
||||
|
||||
fn sock_shutdown(&self, _fd: types::Fd, _how: types::Sdflags) -> Result<()> {
|
||||
unimplemented!("sock_shutdown")
|
||||
Err(Error::Unsupported("sock_shutdown"))
|
||||
}
|
||||
}
|
||||
|
||||
@@ -804,7 +804,7 @@ impl WasiCtx {
|
||||
Err(error) => {
|
||||
events.push(types::Event {
|
||||
userdata: subscription.userdata,
|
||||
error: error.into(),
|
||||
error: error.try_into().expect("non-trapping error"),
|
||||
type_: types::Eventtype::FdRead,
|
||||
fd_readwrite: types::EventFdReadwrite {
|
||||
nbytes: 0,
|
||||
@@ -830,7 +830,7 @@ impl WasiCtx {
|
||||
Err(error) => {
|
||||
events.push(types::Event {
|
||||
userdata: subscription.userdata,
|
||||
error: error.into(),
|
||||
error: error.try_into().expect("non-trapping error"),
|
||||
type_: types::Eventtype::FdWrite,
|
||||
fd_readwrite: types::EventFdReadwrite {
|
||||
nbytes: 0,
|
||||
|
||||
Reference in New Issue
Block a user