systemprompt_provider_contracts/
error.rs1use thiserror::Error;
13
14#[derive(Debug, Error)]
15pub enum ProviderError {
16 #[error("Provider configuration error: {0}")]
17 Configuration(String),
18
19 #[error("Resource not found: {0}")]
20 NotFound(String),
21
22 #[error("Invalid input: {0}")]
23 InvalidInput(String),
24
25 #[error("Render failed: {0}")]
26 RenderFailed(String),
27
28 #[error("I/O error: {0}")]
29 Io(#[from] std::io::Error),
30
31 #[error("YAML error: {0}")]
32 Yaml(#[from] serde_yaml::Error),
33
34 #[error("JSON error: {0}")]
35 Json(#[from] serde_json::Error),
36
37 #[error("Internal provider error: {0}")]
38 Internal(#[source] anyhow::Error),
39}
40
41impl From<anyhow::Error> for ProviderError {
42 fn from(err: anyhow::Error) -> Self {
43 Self::Internal(err)
44 }
45}
46
47pub type ProviderResult<T> = Result<T, ProviderError>;