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
26
27
28
29
30
31
32
use thiserror::Error as ThisError;

/// `nvim-oxi`'s result type.
pub type Result<T> = std::result::Result<T, Error>;

/// `nvim-oxi`'s error type.
#[derive(Clone, Debug, ThisError)]
#[cfg_attr(not(feature = "mlua"), derive(Eq, PartialEq))]
pub enum Error {
    #[error(transparent)]
    Lua(#[from] luajit_bindings::Error),

    #[error(transparent)]
    Api(#[from] nvim_api::Error),

    #[error(transparent)]
    Nvim(#[from] nvim_types::Error),

    #[error(transparent)]
    ObjectConversion(#[from] nvim_types::conversion::Error),

    #[error(transparent)]
    Serde(#[from] nvim_types::serde::Error),

    #[cfg(feature = "libuv")]
    #[error(transparent)]
    Libuv(#[from] libuv_bindings::Error),

    #[cfg(feature = "mlua")]
    #[error(transparent)]
    Mlua(#[from] mlua::Error),
}