Skip to main content

pipedash_core/domain/
error.rs

1use thiserror::Error;
2
3#[derive(Error, Debug)]
4pub enum DomainError {
5    #[error("Provider not found: {0}")]
6    ProviderNotFound(String),
7
8    #[error("Pipeline not found: {0}")]
9    PipelineNotFound(String),
10
11    #[error("Not found: {0}")]
12    NotFound(String),
13
14    #[error("Invalid configuration: {0}")]
15    InvalidConfig(String),
16
17    #[error("Authentication failed: {0}")]
18    AuthenticationFailed(String),
19
20    #[error("API error: {0}")]
21    ApiError(String),
22
23    #[error("Database error: {0}")]
24    DatabaseError(String),
25
26    #[error("Invalid provider type: {0}")]
27    InvalidProviderType(String),
28
29    #[error("Provider error: {0}")]
30    ProviderError(String),
31
32    #[error("Not supported: {0}")]
33    NotSupported(String),
34
35    #[error("Internal error: {0}")]
36    InternalError(String),
37
38    #[allow(dead_code)]
39    #[error("Rate limited: {0}")]
40    RateLimited(String),
41
42    #[error("Network error: {0}")]
43    NetworkError(String),
44
45    #[error("Lock error: {0}")]
46    LockError(String),
47
48    #[error("Concurrent modification: {0}")]
49    ConcurrentModification(String),
50
51    #[error("Configuration file not found - setup wizard required")]
52    ConfigNotFound,
53
54    #[error("Configuration file is invalid: {path} - {errors}")]
55    InvalidConfigFile { path: String, errors: String },
56
57    #[error("Application not initialized - run setup first")]
58    NotInitialized,
59
60    #[error(
61        "Migration failed at step '{step}': {reason}\n\nRECOVERY INSTRUCTIONS:\n{instructions}"
62    )]
63    MigrationFailed {
64        step: String,
65        reason: String,
66        instructions: String,
67    },
68
69    #[error("Data consistency error: {0}")]
70    DataConsistency(String),
71}
72
73pub type DomainResult<T> = Result<T, DomainError>;