From b26eadcd2612c5d2163efa96678d00d0176bd919 Mon Sep 17 00:00:00 2001 From: "Jannis M. Hoffmann" Date: Mon, 9 Dec 2024 13:00:49 +0100 Subject: improve error messages for Remove --- Cargo.lock | 2 +- Cargo.toml | 2 +- src/cmd/remove.rs | 11 ++++++++--- 3 files changed, 10 insertions(+), 5 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 7d3a219..d8523d5 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -206,7 +206,7 @@ dependencies = [ [[package]] name = "jwebmail-extract" -version = "0.9.1" +version = "0.9.2" dependencies = [ "base64", "chrono", diff --git a/Cargo.toml b/Cargo.toml index e1a58f3..dd49d8b 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "jwebmail-extract" -version = "0.9.1" +version = "0.9.2" authors = ["Jannis M. Hoffmann "] edition = "2021" rust-version = "1.80" diff --git a/src/cmd/remove.rs b/src/cmd/remove.rs index 991c835..2779add 100644 --- a/src/cmd/remove.rs +++ b/src/cmd/remove.rs @@ -10,9 +10,14 @@ pub fn remove( if let Some(p) = ms.maildir_path.read().unwrap().clone() { let md = open_submaildir(p, &folder); - md.delete(&mid).map_err(varlink::map_context!())?; - - call.reply() + let res = md.delete(&mid); + match res { + Err(e) if e.kind() == std::io::ErrorKind::NotFound => { + call.reply_invalid_mid(folder, mid) + } + Err(e) => Err(varlink::context!(e, varlink::ErrorKind::from(&e))), + Ok(()) => call.reply(), + } } else { call.reply_not_initialized() } -- cgit v1.2.3