systemprompt_provider_contracts/tool/
error.rs1use thiserror::Error;
7
8#[derive(Debug, Error)]
9pub enum ToolProviderError {
10 #[error("Tool '{0}' not found")]
11 ToolNotFound(String),
12
13 #[error("Service '{0}' not found")]
14 ServiceNotFound(String),
15
16 #[error("Failed to connect to service '{service}': {message}")]
17 ConnectionFailed { service: String, message: String },
18
19 #[error("Tool execution failed: {0}")]
20 ExecutionFailed(String),
21
22 #[error("Authorization failed: {0}")]
23 AuthorizationFailed(String),
24
25 #[error("Configuration error: {message}")]
26 ConfigurationError { message: String },
27
28 #[error("Configuration unavailable: {message}")]
29 Config {
30 message: String,
31 #[source]
32 source: Box<dyn std::error::Error + Send + Sync>,
33 },
34
35 #[error("Internal error: {0}")]
36 Internal(String),
37}
38
39pub type ToolProviderResult<T> = Result<T, ToolProviderError>;