use serde::Deserialize;
use serde::Serialize;
#[derive(Debug, Clone, Serialize, Deserialize)]
pub enum FFIError
{
ZygoteNotInitialized,
NoActiveZygoteScope,
ZygoteCommunicationFailed(String),
LibraryLoadFailed { libraryPath: String, message: String },
LibraryNotFound { libraryPath: String },
SymbolNotFound { functionName: String },
BadArgument(String),
EncodeFailed(String),
DecodeFailed(String),
ArgumentDowncastFailed(String),
Other(String)
}
impl std::fmt::Display for FFIError
{
#[inline]
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result
{
write!(f, "{:?}", self)
}
}
impl<E: std::error::Error + 'static> From<E> for FFIError
{
#[inline]
fn from(err: E) -> Self {
Self::Other(err.to_string())
}
}