rez_next_common/
error.rs

1//! Error types for rez-core
2
3#[cfg(feature = "python-bindings")]
4use pyo3::prelude::*;
5use thiserror::Error;
6
7/// Main error type for rez-core operations
8#[derive(Error, Debug)]
9pub enum RezCoreError {
10    #[error("Version parsing error: {0}")]
11    VersionParse(String),
12
13    #[error("Version range error: {0}")]
14    VersionRange(String),
15
16    #[error("Package parsing error: {0}")]
17    PackageParse(String),
18
19    #[error("Requirement parsing error: {0}")]
20    RequirementParse(String),
21
22    #[error("Solver error: {0}")]
23    Solver(String),
24
25    #[error("Repository error: {0}")]
26    Repository(String),
27
28    #[error("Cache error: {0}")]
29    Cache(String),
30
31    #[error("IO error: {0}")]
32    Io(#[from] std::io::Error),
33
34    #[error("Serialization error: {0}")]
35    Serde(#[from] serde_json::Error),
36
37    #[error("Python error: {0}")]
38    Python(String),
39
40    #[cfg(feature = "python-bindings")]
41    #[error("PyO3 error: {0}")]
42    PyO3(#[from] pyo3::PyErr),
43
44    #[error("Rex error: {0}")]
45    RexError(String),
46
47    #[error("Context error: {0}")]
48    ContextError(String),
49
50    #[error("Build error: {0}")]
51    BuildError(String),
52
53    #[error("Execution error: {0}")]
54    ExecutionError(String),
55
56    #[error("CLI error: {0}")]
57    CliError(String),
58
59    #[error("Configuration error: {0}")]
60    ConfigError(String),
61}
62
63/// Result type alias for rez-core operations
64pub type RezCoreResult<T> = Result<T, RezCoreError>;
65
66// Create Python exception types
67#[cfg(feature = "python-bindings")]
68pyo3::create_exception!(rez_core, PyRezCoreError, pyo3::exceptions::PyException);