clean up error contexts
This commit is contained in:
+4
-2
@@ -47,10 +47,12 @@ fn main_inner() -> Result<()> {
|
|||||||
let args = get_args();
|
let args = get_args();
|
||||||
|
|
||||||
let config_file = get_config_path().context("getting config file")?;
|
let config_file = get_config_path().context("getting config file")?;
|
||||||
let config = Config::load(&config_file).context("loading config file")?;
|
let config = Config::load(&config_file)
|
||||||
|
.with_context(|| format!("loading config file {}", config_file.to_string_lossy()))?;
|
||||||
|
|
||||||
let group_dir = get_group_dir().context("resolving group dir")?;
|
let group_dir = get_group_dir().context("resolving group dir")?;
|
||||||
let groups = Group::load(&group_dir, config.warn_not_symlinks).context("loading groups")?;
|
let groups = Group::load(&group_dir, config.warn_not_symlinks)
|
||||||
|
.with_context(|| format!("loading groups under {}", group_dir.to_string_lossy()))?;
|
||||||
|
|
||||||
let pacdef = Pacdef::new(args, config, groups);
|
let pacdef = Pacdef::new(args, config, groups);
|
||||||
pacdef.run_action_from_arg().context("running action")
|
pacdef.run_action_from_arg().context("running action")
|
||||||
|
|||||||
@@ -36,8 +36,7 @@ impl Group {
|
|||||||
if !group_dir.is_dir() {
|
if !group_dir.is_dir() {
|
||||||
// we only need to create the innermost dir. The rest was already created from when
|
// we only need to create the innermost dir. The rest was already created from when
|
||||||
// we loaded the config
|
// we loaded the config
|
||||||
create_dir(group_dir)
|
create_dir(group_dir).context("group dir does not exist, creating")?;
|
||||||
.with_context(|| format!("creating group dir {}", group_dir.to_string_lossy()))?;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
for entry in group_dir.read_dir().context("reading group dir")? {
|
for entry in group_dir.read_dir().context("reading group dir")? {
|
||||||
|
|||||||
Reference in New Issue
Block a user