kovi_plugin_live_agent/
exception.rs

1//! Datatypes for exceptions caused by plugin and user.
2use thiserror::Error;
3pub type PluginResult<T> = Result<T, PluginError>;
4
5#[derive(Error, Debug)]
6pub enum PluginError {
7    #[error("IO error: {0}.")]
8    IO(#[from] std::io::Error),
9    #[error("Database error: {0}.")]
10    Database(#[from] sqlx::Error),
11    #[error("Timestamp out of bound: {0}.")]
12    TimeStampOutOfBound(#[from] time::error::ComponentRange),
13    #[error("Time format error: {0}.")]
14    TimeFormat(#[from] time::error::Format),
15    #[error("Reqwest error: {0}.")]
16    HttpRequest(#[from] reqwest::Error),
17    #[error("Regex error: {0}.")]
18    Regex(#[from] regex::Error),
19    #[error("Agent request error: {0}.")]
20    AgentRequest(String),
21    #[error("Serialize to toml failed, cause: {0}")]
22    SerializeToml(String),
23    #[error("Deserialize to toml failed, cause: {0}")]
24    DeserializeToml(String),
25    #[error("Path not available: {0}.")]
26    PathNotAvailable(String),
27    #[error("Launched child process {0} failed, cause: {1}")]
28    ChildProcess(String, String),
29    #[error("Initialize global state failed, cause: {0}")]
30    InitGlobalState(String),
31    #[error("Trap to logically unreachable control.")]
32    Unreachable,
33}