mirror of
https://github.com/fluencelabs/wasmer
synced 2025-06-14 09:21:20 +00:00
Return type normalization, and change return errors from imported functions
This commit is contained in:
@ -1,4 +1,4 @@
|
||||
use crate::types::{FuncSig, GlobalDescriptor, MemoryDescriptor, TableDescriptor, Type, Value};
|
||||
use crate::types::{FuncSig, GlobalDescriptor, MemoryDescriptor, TableDescriptor, Type};
|
||||
use core::borrow::Borrow;
|
||||
use std::any::Any;
|
||||
|
||||
@ -121,8 +121,7 @@ impl std::error::Error for LinkError {}
|
||||
/// Comparing two `RuntimeError`s always evaluates to false.
|
||||
pub enum RuntimeError {
|
||||
Trap { msg: Box<str> },
|
||||
Exception { data: Box<[Value]> },
|
||||
Panic { data: Box<dyn Any> },
|
||||
Error { data: Box<dyn Any> },
|
||||
}
|
||||
|
||||
impl PartialEq for RuntimeError {
|
||||
@ -137,10 +136,7 @@ impl std::fmt::Display for RuntimeError {
|
||||
RuntimeError::Trap { ref msg } => {
|
||||
write!(f, "WebAssembly trap occured during runtime: {}", msg)
|
||||
}
|
||||
RuntimeError::Exception { ref data } => {
|
||||
write!(f, "Uncaught WebAssembly exception: {:?}", data)
|
||||
}
|
||||
RuntimeError::Panic { data } => {
|
||||
RuntimeError::Error { data } => {
|
||||
let msg = if let Some(s) = data.downcast_ref::<String>() {
|
||||
s
|
||||
} else if let Some(s) = data.downcast_ref::<&str>() {
|
||||
|
Reference in New Issue
Block a user