2020-12-11 23:37:22 +00:00
|
|
|
use bincode::ErrorKind;
|
2021-01-08 08:48:30 +00:00
|
|
|
use wasmer::{ExportError, InstantiationError, RuntimeError};
|
2020-12-11 23:37:22 +00:00
|
|
|
|
2021-01-08 08:48:30 +00:00
|
|
|
#[allow(clippy::large_enum_variant)]
|
2020-12-11 23:37:22 +00:00
|
|
|
#[derive(Debug)]
|
|
|
|
pub enum PluginError {
|
|
|
|
Io(std::io::Error),
|
|
|
|
Toml(toml::de::Error),
|
|
|
|
NoConfig,
|
|
|
|
NoSuchModule,
|
2021-01-08 08:48:30 +00:00
|
|
|
Encoding(Box<ErrorKind>),
|
|
|
|
PluginModuleError(String, String, PluginModuleError),
|
2020-12-11 23:37:22 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
#[derive(Debug)]
|
|
|
|
pub enum PluginModuleError {
|
2021-01-08 08:48:30 +00:00
|
|
|
InstantiationError(InstantiationError),
|
2020-12-14 16:07:05 +00:00
|
|
|
MemoryAllocation(MemoryAllocationError),
|
2021-01-08 08:48:30 +00:00
|
|
|
MemoryUninit(ExportError),
|
|
|
|
FindFunction(ExportError),
|
2020-12-11 23:37:22 +00:00
|
|
|
RunFunction(RuntimeError),
|
2021-01-08 08:48:30 +00:00
|
|
|
InvalidArgumentType(),
|
2020-12-11 23:37:22 +00:00
|
|
|
Encoding(Box<ErrorKind>),
|
2020-12-13 17:40:15 +00:00
|
|
|
}
|
2020-12-14 16:07:05 +00:00
|
|
|
|
|
|
|
#[derive(Debug)]
|
|
|
|
pub enum MemoryAllocationError {
|
2021-01-08 08:48:30 +00:00
|
|
|
AllocatorNotFound(ExportError),
|
2020-12-14 16:07:05 +00:00
|
|
|
CantAllocate(RuntimeError),
|
|
|
|
}
|