diff options
| author | Jamie Quigley <jamie@quigley.xyz> | 2021-05-09 15:20:39 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-05-09 15:20:39 +0100 |
| commit | 725ea9b16b1e3596b394fa7e47e02a9331de10cf (patch) | |
| tree | 8459d67f1ac764091b6e26dfe4538ed021c0554d /src/command/import.rs | |
| parent | Run shellcheck on bash file (#81) (diff) | |
| download | atuin-725ea9b16b1e3596b394fa7e47e02a9331de10cf.zip | |
Fix resh importer, and change error handling method (#82)
Diffstat (limited to '')
| -rw-r--r-- | src/command/import.rs | 12 |
1 files changed, 11 insertions, 1 deletions
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::<ReshEntry>(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)] |
