1use thiserror::Error;
8
9#[derive(Error, Debug)]
11pub enum NapError {
12 #[error("invalid NAP URI '{uri}': {reason}")]
14 InvalidUri { uri: String, reason: String },
15
16 #[error("unknown entity type '{0}'")]
17 UnknownEntityType(String),
18
19 #[error("manifest not found: {0}")]
21 ManifestNotFound(String),
22
23 #[error("manifest parse error for '{path}': {source}")]
24 ManifestParseError {
25 path: String,
26 source: serde_yaml::Error,
27 },
28
29 #[error("manifest validation error: {0}")]
30 ManifestValidationError(String),
31
32 #[error("manifest write error for '{path}': {source}")]
33 ManifestWriteError {
34 path: String,
35 source: std::io::Error,
36 },
37
38 #[error("query path not found: '{path}' in manifest '{manifest_id}'")]
40 QueryPathNotFound { path: String, manifest_id: String },
41
42 #[error("invalid query path: '{0}'")]
43 InvalidQueryPath(String),
44
45 #[error("repository not found at '{0}'")]
47 RepositoryNotFound(String),
48
49 #[error("repository already exists at '{0}'")]
50 RepositoryAlreadyExists(String),
51
52 #[error("universe '{0}' not found in repository root")]
53 UniverseNotFound(String),
54
55 #[error("VCS error: {0}")]
57 VcsError(String),
58
59 #[error("ref not found: '{0}'")]
60 RefNotFound(String),
61
62 #[error("content hash mismatch: expected {expected}, got {actual}")]
64 ContentHashMismatch { expected: String, actual: String },
65
66 #[error("I/O error: {0}")]
68 Io(#[from] std::io::Error),
69
70 #[error("merge conflict at '{path}': {details}")]
72 MergeConflict { path: String, details: String },
73
74 #[error("SDL parse error: {0}")]
75 SdlParseError(String),
76
77 #[error("SDL validation error: {reason}")]
78 SdlValidationError { reason: String },
79
80 #[error("merge strategy error at '{path}': {reason}")]
81 MergeStrategyError { path: String, reason: String },
82
83 #[error("merge validation error: {reason}")]
84 MergeValidationError { reason: String },
85
86 #[error("permission denied: {0}")]
88 PermissionDenied(String),
89
90 #[error("gRPC error: {0}")]
92 GrpcError(String),
93
94 #[error("{0}")]
96 Other(String),
97}
98
99pub type NapResult<T> = Result<T, NapError>;