Skip to main content

boarddown_core/
error.rs

1use thiserror::Error;
2
3#[derive(Debug, Error)]
4pub enum Error {
5    #[error("IO error: {0}")]
6    Io(#[from] std::io::Error),
7
8    #[error("Parse error: {0}")]
9    Parse(String),
10
11    #[error("Invalid task ID: {0}")]
12    InvalidTaskId(String),
13
14    #[error("Invalid board ID: {0}")]
15    InvalidBoardId(String),
16
17    #[error("Task not found: {0}")]
18    TaskNotFound(String),
19
20    #[error("Board not found: {0}")]
21    BoardNotFound(String),
22
23    #[error("Column not found: {0}")]
24    ColumnNotFound(String),
25
26    #[error("Workspace not found: {0}")]
27    WorkspaceNotFound(String),
28
29    #[error("Validation error: {0}")]
30    Validation(String),
31
32    #[error("Conflict detected: {0}")]
33    Conflict(String),
34
35    #[error("Storage error: {0}")]
36    Storage(String),
37
38    #[error("Sync error: {0}")]
39    Sync(String),
40
41    #[error("Configuration error: {0}")]
42    Config(String),
43
44    #[error("Serialization error: {0}")]
45    Serialization(#[from] serde_json::Error),
46
47    #[error("YAML error: {0}")]
48    Yaml(#[from] serde_yaml::Error),
49
50    #[error("Database error: {0}")]
51    Database(String),
52
53    #[error("Lock error: {0}")]
54    Lock(String),
55
56    #[error("Channel send error")]
57    ChannelSend,
58
59    #[error("Operation cancelled")]
60    Cancelled,
61
62    #[error("Not implemented")]
63    NotImplemented,
64}
65
66pub type Result<T> = std::result::Result<T, Error>;
67
68impl From<Error> for std::io::Error {
69    fn from(err: Error) -> Self {
70        std::io::Error::new(std::io::ErrorKind::Other, err)
71    }
72}