generate: now we have a way to do errors, i guess

This commit is contained in:
Pat Hickey
2020-01-22 20:47:40 -08:00
parent 97077954f8
commit c05475b806
8 changed files with 158 additions and 96 deletions

View File

@@ -1,6 +1,21 @@
pub mod test {
pub struct WasiCtx {} // FIXME: parameterize macro on what ctx type is used here
generate::from_witx!("test.witx");
pub struct WasiCtx {} // FIXME: parameterize macro on what ctx type is used here
impl types::WitxErrorConversion for WasiCtx {
fn success_to_errno(&mut self) -> types::Errno {
types::Errno::Ok
}
fn memory_error_to_errno(&mut self, e: ::memory::MemoryError) -> types::Errno {
eprintln!("memory error: {:?}", e);
types::Errno::InvalidArg
}
fn value_error_to_errno(&mut self, e: ::memory::GuestValueError) -> types::Errno {
eprintln!("guest value error: {:?}", e);
types::Errno::InvalidArg
}
}
}
/*
pub mod wasi {