Hook up error propagation

This commit is contained in:
Lachlan Sneff
2019-04-22 15:06:40 -07:00
parent a42b7d3815
commit 706ddabf61
13 changed files with 185 additions and 124 deletions

View File

@ -137,15 +137,13 @@ impl std::fmt::Display for RuntimeError {
write!(f, "WebAssembly trap occured during runtime: {}", msg)
}
RuntimeError::Error { data } => {
let msg = if let Some(s) = data.downcast_ref::<String>() {
s
if let Some(s) = data.downcast_ref::<String>() {
write!(f, "\"{}\"", s)
} else if let Some(s) = data.downcast_ref::<&str>() {
s
write!(f, "\"{}\"", s)
} else {
"user-defined, opaque"
};
write!(f, "{}", msg)
write!(f, "unknown error")
}
}
}
}