Skip to main content

bamboo_llm/
error.rs

1//! Error types for LLM operations.
2//!
3//! This module provides error types for handling LLM-related failures,
4//! including authentication, network, and API errors.
5
6use thiserror::Error;
7
8/// Re-export of the main LLM error type.
9pub use crate::provider::LLMError;
10
11/// Error indicating that proxy authentication is required.
12///
13/// This error is returned when a proxy server requires authentication
14/// credentials that were not provided.
15#[derive(Debug, Error)]
16#[error("proxy_auth_required")]
17pub struct ProxyAuthRequiredError;
18
19#[cfg(test)]
20mod tests {
21    use super::*;
22
23    #[test]
24    fn test_proxy_auth_required_error_creation() {
25        let err = ProxyAuthRequiredError;
26        assert_eq!(err.to_string(), "proxy_auth_required");
27    }
28
29    #[test]
30    fn test_proxy_auth_required_error_debug() {
31        let err = ProxyAuthRequiredError;
32        let debug_str = format!("{:?}", err);
33        assert!(debug_str.contains("ProxyAuthRequiredError"));
34    }
35
36    #[test]
37    fn test_proxy_auth_required_error_display() {
38        let err = ProxyAuthRequiredError;
39        let display_str = format!("{}", err);
40        assert_eq!(display_str, "proxy_auth_required");
41    }
42}