1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
use std::io::Error as IoError;

pub type DevrcPluginResult<T> = Result<T, DevrcPluginError>;

#[derive(Debug)]
pub enum DevrcPluginError {
    NotFound(String),
    LoadingError(libloading::Error),
    Code { code: i32 },
    Signal,
    IoError(IoError),
    AnyhowError(anyhow::Error),
}

impl From<libloading::Error> for DevrcPluginError {
    fn from(value: libloading::Error) -> Self {
        DevrcPluginError::LoadingError(value)
    }
}

impl From<anyhow::Error> for DevrcPluginError {
    fn from(error: anyhow::Error) -> Self {
        DevrcPluginError::AnyhowError(error)
    }
}