use thiserror::Error;
#[derive(Error, Debug)]
pub enum NapError {
#[error("invalid NAP URI '{uri}': {reason}")]
InvalidUri { uri: String, reason: String },
#[error("unknown entity type '{0}'")]
UnknownEntityType(String),
#[error("manifest not found: {0}")]
ManifestNotFound(String),
#[error("manifest parse error for '{path}': {source}")]
ManifestParseError {
path: String,
source: serde_yaml::Error,
},
#[error("manifest validation error: {0}")]
ManifestValidationError(String),
#[error("manifest write error for '{path}': {source}")]
ManifestWriteError {
path: String,
source: std::io::Error,
},
#[error("query path not found: '{path}' in manifest '{manifest_id}'")]
QueryPathNotFound { path: String, manifest_id: String },
#[error("invalid query path: '{0}'")]
InvalidQueryPath(String),
#[error("repository not found at '{0}'")]
RepositoryNotFound(String),
#[error("repository already exists at '{0}'")]
RepositoryAlreadyExists(String),
#[error("universe '{0}' not found in repository root")]
UniverseNotFound(String),
#[error("VCS error: {0}")]
VcsError(String),
#[error("ref not found: '{0}'")]
RefNotFound(String),
#[error("content hash mismatch: expected {expected}, got {actual}")]
ContentHashMismatch { expected: String, actual: String },
#[error("I/O error: {0}")]
Io(#[from] std::io::Error),
#[error("merge conflict at '{path}': {details}")]
MergeConflict { path: String, details: String },
#[error("SDL parse error: {0}")]
SdlParseError(String),
#[error("SDL validation error: {reason}")]
SdlValidationError { reason: String },
#[error("merge strategy error at '{path}': {reason}")]
MergeStrategyError { path: String, reason: String },
#[error("merge validation error: {reason}")]
MergeValidationError { reason: String },
#[error("no branch or commit specified and no default_branch configured. ")]
NoDefaultBranch,
#[error("permission denied: {0}")]
PermissionDenied(String),
#[error("gRPC error: {0}")]
GrpcError(String),
#[error("{0}")]
Other(String),
}
pub type NapResult<T> = Result<T, NapError>;