From 0ecbd50c8ac3fdf47ab81e875270924340ca64ff Mon Sep 17 00:00:00 2001 From: soruh Date: Wed, 15 Feb 2023 14:28:30 +0100 Subject: [PATCH] print message when cache file is unreadable --- src/main.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/main.rs b/src/main.rs index 9d4da37..305be7e 100644 --- a/src/main.rs +++ b/src/main.rs @@ -145,7 +145,10 @@ impl PortHandler { } fn load_or_default(cache: &Path) -> Self { - Self::load(cache).unwrap_or(Self::default()) + Self::load(cache).unwrap_or_else(|err| { + println!("failed to parse cache file at {cache:?} using empty cache. error: {err}"); + Self::default() + }) } fn update_allowed_ports(&mut self, allowed_ports: &AllowedPorts) {