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("Ambiguous repository name: {0}")]
9    AmbiguousRepoName(String),
10
11    #[error("Symbol not found: {0}")]
12    SymbolNotFound(String),
13
14    #[error("Session not found: {0}")]
15    SessionNotFound(String),
16
17    #[error("Session expired: {0}")]
18    SessionExpired(String),
19
20    #[error("Invalid input: {0}")]
21    InvalidInput(String),
22
23    #[error("Invalid auth token")]
24    InvalidAuth,
25
26    #[error("Conflict: {0}")]
27    Conflict(String),
28
29    #[error("Parse error: {0}")]
30    ParseError(String),
31
32    #[error("Unsupported language: {0}")]
33    UnsupportedLanguage(String),
34
35    #[error("Database error: {0}")]
36    Database(#[from] sqlx::Error),
37
38    #[error("Git error: {0}")]
39    Git(String),
40
41    #[error("IO error: {0}")]
42    Io(#[from] std::io::Error),
43
44    #[error("{0}")]
45    Internal(String),
46}
47
48pub type Result<T> = std::result::Result<T, Error>;