chronicle_proxy/
error.rs

1/// Proxy errors
2#[derive(thiserror::Error, Debug)]
3pub enum Error {
4    /// A specified model provider was not found
5    #[error("Unknown model provider {0}")]
6    UnknownProvider(String),
7
8    /// No provider was specified, and no default could be inferred from the model name
9    #[error("No default provider for model {0}")]
10    NoDefault(String),
11
12    /// An alias references a provider that doesn't exist
13    #[error("Alias {0} references nonexistent provider {1}")]
14    NoAliasProvider(String, String),
15
16    /// An alias does not reference any models
17    #[error("Alias {0} has no associated models")]
18    AliasEmpty(String),
19
20    /// An alias references an API key that doesn't exist
21    #[error("Alias {0} references nonexistent API key {1}")]
22    NoAliasApiKey(String, String),
23
24    /// The requested API key does not exist
25    #[error("Unknown API key name {0}")]
26    NoApiKey(String),
27
28    /// The request is missing the model name
29    #[error("Request is missing model name")]
30    ModelNotSpecified,
31
32    /// The model provider returned an error
33    #[error("Model provider returned an error")]
34    ModelError,
35
36    /// The API key was not provided
37    #[error("API key not provided")]
38    MissingApiKey,
39
40    /// The environment variable for the API key was not found
41    #[error("Did not find environment variable {1} for API key {0}")]
42    MissingApiKeyEnv(String, String),
43
44    /// Failed to parse the model provider's output
45    #[error("Failed to parse model provider's output")]
46    ResultParseError,
47
48    /// Failed to read the configuration file
49    #[error("Failed to read configuration file")]
50    ReadingConfig,
51
52    /// Failed to load data from the database
53    #[error("Failed to load from the database")]
54    LoadingDatabase,
55
56    /// Failed to parse a header value
57    #[error("Failed to parse header value {0}: Expected a {1}")]
58    ReadingHeader(String, &'static str),
59
60    /// A required piece of information was missing from the response stream
61    #[error("Did not see {0} in response stream")]
62    MissingStreamInformation(&'static str),
63}