From 3b11ed27676e809159dfe15bb5540c80b92c1df7 Mon Sep 17 00:00:00 2001 From: HimbeerserverDE Date: Sun, 19 Mar 2023 21:39:46 +0100 Subject: print usable error messages --- src/error.rs | 8 ++++---- src/main.rs | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/error.rs b/src/error.rs index 600db68..2440169 100644 --- a/src/error.rs +++ b/src/error.rs @@ -6,13 +6,13 @@ use thiserror::Error; pub enum Error { #[error("link {0} not found")] LinkNotFound(String), - #[error("io")] + #[error("io: {0}")] Io(#[from] io::Error), - #[error("notify")] + #[error("notify: {0}")] Notify(#[from] notify::Error), - #[error("rtnetlink")] + #[error("rtnetlink: {0}")] RtNetlink(#[from] rtnetlink::Error), - #[error("serde_json")] + #[error("serde_json: {0}")] SerdeJson(#[from] serde_json::Error), } diff --git a/src/main.rs b/src/main.rs index 6abdccc..a06e9f6 100644 --- a/src/main.rs +++ b/src/main.rs @@ -24,7 +24,7 @@ fn main() -> Result<()> { let mut watcher = notify::recommended_watcher(|res: notify::Result| match res { Ok(_) => configure_wan(), - Err(e) => println!("[netlinkd] watch error: {}", e), + Err(e) => println!("[netlinkd] watch error: {:?}", e), })?; watcher.watch(ip_config, RecursiveMode::NonRecursive)?; @@ -37,7 +37,7 @@ fn main() -> Result<()> { fn configure_wan() { match configure_rsppp0() { Ok(_) => println!("[netlinkd] configure rsppp0 with PPPoE data"), - Err(e) => println!("[netlinkd] can't configure rsppp0: {}", e), + Err(e) => println!("[netlinkd] can't configure rsppp0: {:?}", e), } } -- cgit v1.2.3