From 725ea9b16b1e3596b394fa7e47e02a9331de10cf Mon Sep 17 00:00:00 2001 From: Jamie Quigley Date: Sun, 9 May 2021 15:20:39 +0100 Subject: Fix resh importer, and change error handling method (#82) --- src/command/import.rs | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'src/command') diff --git a/src/command/import.rs b/src/command/import.rs index c51e918f..9a0364da 100644 --- a/src/command/import.rs +++ b/src/command/import.rs @@ -78,7 +78,17 @@ async fn import_resh(db: &mut (impl Database + Send + Sync)) -> Result<()> { .split('\n') .map(str::trim) .map(|x| serde_json::from_str::(x)) - .filter_map(Result::ok) + .filter_map(|x| match x { + Ok(x) => Some(x), + Err(e) => { + if e.is_eof() { + None + } else { + warn!("Invalid entry found in resh_history file: {}", e); + None + } + } + }) .map(|x| { #[allow(clippy::cast_possible_truncation)] #[allow(clippy::cast_sign_loss)] -- cgit v1.3.1