Skip to main content

dkp_gen_core/
error.rs

1use thiserror::Error;
2
3#[derive(Debug, Error)]
4pub enum GenError {
5    #[error("IO error: {0}")]
6    Io(#[from] std::io::Error),
7
8    #[error("JSON error: {0}")]
9    Json(#[from] serde_json::Error),
10
11    #[error("HTTP {status}: {body}")]
12    Http { status: u16, body: String },
13
14    #[error("LLM refused to produce output: {0}")]
15    LlmRefusal(String),
16
17    #[error("could not extract JSON from LLM response: {0}")]
18    JsonExtraction(String),
19
20    #[error("could not extract JSONL from LLM response: {0}")]
21    JsonlExtraction(String),
22
23    #[error("dkp-core error: {0}")]
24    DkpCore(#[from] dkp_core::error::DkpError),
25
26    #[error("packaging error: {0}")]
27    Packaging(String),
28
29    #[error("asset skipped: {0}")]
30    AssetSkipped(String),
31
32    #[error("tool loop error: {0}")]
33    ToolLoop(String),
34
35    #[error("tool '{name}' failed: {message}")]
36    ToolFailed { name: String, message: String },
37}
38
39pub type GenResult<T> = Result<T, GenError>;