pub(crate) mod inner;
pub(crate) use inner::*;
use wasmer_types::{TagType, Type};
use crate::{
AsStoreMut, AsStoreRef, ExportError, Exportable, Extern, Tag, Value,
vm::{VMExceptionRef, VMExtern, VMExternTag},
};
#[derive(Debug, Clone, PartialEq, Eq, derive_more::From)]
#[cfg_attr(feature = "artifact-size", derive(loupe::MemoryUsage))]
pub struct Exception(pub(crate) BackendException);
impl Exception {
pub fn new(store: &mut impl AsStoreMut, tag: &Tag, payload: &[Value]) -> Self {
Self(BackendException::new(store, tag, payload))
}
pub fn is_from_store(&self, store: &impl AsStoreRef) -> bool {
self.0.is_from_store(store)
}
pub fn tag(&self, store: &impl AsStoreRef) -> Tag {
self.0.tag(store)
}
pub fn payload(&self, store: &mut impl AsStoreMut) -> Vec<Value> {
self.0.payload(store)
}
pub fn vm_exceptionref(&self) -> VMExceptionRef {
self.0.vm_exceptionref()
}
pub fn from_vm_exceptionref(exnref: VMExceptionRef) -> Self {
Self(BackendException::from_vm_exceptionref(exnref))
}
}