wasmer/entities/exception/
mod.rs1pub(crate) mod inner;
2pub(crate) use inner::*;
3use wasmer_types::{TagType, Type};
4
5use crate::{
6 AsStoreMut, AsStoreRef, ExportError, Exportable, Extern, Tag, Value,
7 vm::{VMExceptionRef, VMExtern, VMExternTag},
8};
9
10#[derive(Debug, Clone, PartialEq, Eq, derive_more::From)]
17#[cfg_attr(feature = "artifact-size", derive(loupe::MemoryUsage))]
18pub struct Exception(pub(crate) BackendException);
19
20impl Exception {
21 pub fn new(store: &mut impl AsStoreMut, tag: &Tag, payload: &[Value]) -> Self {
24 Self(BackendException::new(store, tag, payload))
25 }
26
27 pub fn is_from_store(&self, store: &impl AsStoreRef) -> bool {
29 self.0.is_from_store(store)
30 }
31
32 pub fn tag(&self, store: &impl AsStoreRef) -> Tag {
34 self.0.tag(store)
35 }
36
37 pub fn payload(&self, store: &mut impl AsStoreMut) -> Vec<Value> {
39 self.0.payload(store)
40 }
41
42 pub fn vm_exceptionref(&self) -> VMExceptionRef {
44 self.0.vm_exceptionref()
45 }
46
47 pub fn from_vm_exceptionref(exnref: VMExceptionRef) -> Self {
49 Self(BackendException::from_vm_exceptionref(exnref))
50 }
51}