Propagate FennelError directly instead of flattening to String
Error::Fennel now wraps FennelError via #[from], preserving miette
source labels and line information. Removes four .map_err closures.
Assisted-by: GLM-5.1 via pi
diff --git a/src/error.rs b/src/error.rs
index 7f4940c..c930e2f 100644
--- a/src/error.rs
+++ b/src/error.rs
@@ -12,8 +12,8 @@ pub enum Error {
#[error("config not found: {0}")]
ConfigNotFound(String),
- #[error("fennel error: {0}")]
- Fennel(String),
+ #[error(transparent)]
+ Fennel(#[from] crate::fennel::FennelError),
#[error("git error: {0}")]
Git(String),
diff --git a/src/quire.rs b/src/quire.rs
index 6eee5c9..3935aaf 100644
--- a/src/quire.rs
+++ b/src/quire.rs
@@ -91,10 +91,8 @@ impl Repo {
))
})?;
- let fennel = Fennel::new().map_err(|e| crate::Error::Fennel(e.to_string()))?;
- fennel
- .load_string(&source, "HEAD:.quire/config.fnl")
- .map_err(|e| crate::Error::Fennel(e.to_string()))
+ let fennel = Fennel::new()?;
+ Ok(fennel.load_string(&source, "HEAD:.quire/config.fnl")?)
}
}
@@ -141,10 +139,8 @@ impl Quire {
config_path.display().to_string(),
));
}
- let fennel = Fennel::new().map_err(|e| crate::Error::Fennel(e.to_string()))?;
- fennel
- .load_file(&config_path)
- .map_err(|e| crate::Error::Fennel(e.to_string()))
+ let fennel = Fennel::new()?;
+ Ok(fennel.load_file(&config_path)?)
}
/// Validate a repository name and return its resolved path.