orbis_plugin_api/
error.rs1#[derive(Debug, thiserror::Error)]
5pub enum Error {
6 #[error("Invalid plugin: {0}")]
8 InvalidPlugin(String),
9
10 #[error("Invalid manifest: {0}")]
12 InvalidManifest(String),
13
14 #[error("Invalid UI schema: {0}")]
16 InvalidSchema(String),
17
18 #[error("Validation error: {0}")]
20 Validation(String),
21
22 #[error("Serialization error: {0}")]
24 Serialization(#[from] serde_json::Error),
25}
26
27impl Error {
28 #[must_use]
30 pub fn plugin<S: Into<String>>(msg: S) -> Self {
31 Self::InvalidPlugin(msg.into())
32 }
33
34 #[must_use]
36 pub fn manifest<S: Into<String>>(msg: S) -> Self {
37 Self::InvalidManifest(msg.into())
38 }
39
40 #[must_use]
42 pub fn schema<S: Into<String>>(msg: S) -> Self {
43 Self::InvalidSchema(msg.into())
44 }
45
46 #[must_use]
48 pub fn validation<S: Into<String>>(msg: S) -> Self {
49 Self::Validation(msg.into())
50 }
51}
52
53pub type Result<T> = std::result::Result<T, Error>;