kovi_plugin_live_agent/
exception.rs

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
33
//! Datatypes for exceptions caused by plugin and user.
use thiserror::Error;
pub type PluginResult<T> = Result<T, PluginError>;

#[derive(Error, Debug)]
pub enum PluginError {
    #[error("IO error: {0}.")]
    IO(#[from] std::io::Error),
    #[error("Database error: {0}.")]
    Database(#[from] sqlx::Error),
    #[error("Timestamp out of bound: {0}.")]
    TimeStampOutOfBound(#[from] time::error::ComponentRange),
    #[error("Time format error: {0}.")]
    TimeFormat(#[from] time::error::Format),
    #[error("Reqwest error: {0}.")]
    HttpRequest(#[from] reqwest::Error),
    #[error("Regex error: {0}.")]
    Regex(#[from] regex::Error),
    #[error("Agent request error: {0}.")]
    AgentRequest(String),
    #[error("Serialize to toml failed, cause: {0}")]
    SerializeToml(String),
    #[error("Deserialize to toml failed, cause: {0}")]
    DeserializeToml(String),
    #[error("Path not available: {0}.")]
    PathNotAvailable(String),
    #[error("Launched child process {0} failed, cause: {1}")]
    ChildProcess(String, String),
    #[error("Initialize global state failed, cause: {0}")]
    InitGlobalState(String),
    #[error("Trap to logically unreachable control.")]
    Unreachable,
}