From 6336eeb5688dc0733b55fb1e1826deb55e6cabd7 Mon Sep 17 00:00:00 2001 From: holger krekel Date: Mon, 4 Nov 2019 15:02:24 +0100 Subject: [PATCH] better error on has_backup() failing --- src/imex.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/imex.rs b/src/imex.rs index 4c23c4543..3b5130c65 100644 --- a/src/imex.rs +++ b/src/imex.rs @@ -75,7 +75,7 @@ pub fn imex(context: &Context, what: ImexMode, param1: Option>) job_add(context, Action::ImexImap, 0, param, 0); } -/// Returns the filename of the backup if found, nullptr otherwise. +/// Returns the filename of the backup found (otherwise an error) pub fn has_backup(context: &Context, dir_name: impl AsRef) -> Result { let dir_name = dir_name.as_ref(); let dir_iter = std::fs::read_dir(dir_name)?; @@ -105,7 +105,7 @@ pub fn has_backup(context: &Context, dir_name: impl AsRef) -> Result Ok(path.to_string_lossy().into_owned()), - None => bail!("no backup found"), + None => bail!("no backup found in {}", dir_name.display()), } }