Skip to main content

dk_core/
error.rs

1use thiserror::Error;
2
3#[derive(Error, Debug)]
4pub enum Error {
5    #[error("Repository not found: {0}")]
6    RepoNotFound(String),
7
8    #[error("Symbol not found: {0}")]
9    SymbolNotFound(String),
10
11    #[error("Session not found: {0}")]
12    SessionNotFound(String),
13
14    #[error("Session expired: {0}")]
15    SessionExpired(String),
16
17    #[error("Invalid input: {0}")]
18    InvalidInput(String),
19
20    #[error("Invalid auth token")]
21    InvalidAuth,
22
23    #[error("Conflict: {0}")]
24    Conflict(String),
25
26    #[error("Parse error: {0}")]
27    ParseError(String),
28
29    #[error("Unsupported language: {0}")]
30    UnsupportedLanguage(String),
31
32    #[error("Database error: {0}")]
33    Database(#[from] sqlx::Error),
34
35    #[error("Git error: {0}")]
36    Git(String),
37
38    #[error("IO error: {0}")]
39    Io(#[from] std::io::Error),
40
41    #[error("{0}")]
42    Internal(String),
43}
44
45pub type Result<T> = std::result::Result<T, Error>;