1use thiserror::Error as ThisError;
2
3#[derive(ThisError, Debug)]
5pub enum Error {
6 #[error("Missing mandatory arguments: {0}\nTry `apprentice --help` for more information.")]
8 MissingArgError(&'static str),
9
10 #[error("Failed to call LLM: {0}")]
12 LLMCallError(#[from] reqwest::Error),
13
14 #[error("Failed to process LLM call: {0}")]
16 LLMJsonError(#[from] serde_json::Error),
17
18 #[error("Failed to parse LLM response: {0}")]
20 LLMResponseError(&'static str),
21
22 #[error("{0}")]
24 Error(String),
25
26 #[error("LLM provider responded with error: {0}")]
28 LLMErrorMessage(String),
29
30 #[cfg(test)]
32 #[error("Test error: {0}")]
33 ForTests(&'static str),
34}