use thiserror::Error;
pub use wasmer_types::ImportError;
#[cfg(not(target_arch = "wasm32"))]
use wasmer_vm::Trap;
#[derive(Error, Debug)]
#[error("Link error: {0}")]
pub enum LinkError {
#[error("Error while importing {0:?}.{1:?}: {2}")]
Import(String, String, ImportError),
#[cfg(not(target_arch = "wasm32"))]
#[error("Trap occurred during linking: {0}")]
Trap(#[source] Trap),
#[error("Insufficient resources: {0}")]
Resource(String),
}
#[derive(Error, Debug)]
pub enum InstantiationError {
#[error(transparent)]
Link(LinkError),
#[error("module compiled with CPU feature that is missing from host")]
CpuFeature(String),
#[cfg(not(target_arch = "wasm32"))]
#[error(transparent)]
Start(Trap),
}