#[derive(Debug, thiserror::Error)]
pub enum FactoryError {
#[error("Unsupported provider: {0}")]
UnsupportedProvider(String),
#[error("Failed to create client: {0}")]
ClientCreationFailed(String),
}
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn factory_error_display_shapes() {
let err = FactoryError::UnsupportedProvider("test".into());
assert_eq!(err.to_string(), "Unsupported provider: test");
let err =
FactoryError::ClientCreationFailed("Missing API key for provider: anthropic".into());
assert_eq!(
err.to_string(),
"Failed to create client: Missing API key for provider: anthropic"
);
let err = FactoryError::ClientCreationFailed("timeout".into());
assert_eq!(err.to_string(), "Failed to create client: timeout");
}
}