Improve bad Unicode error handling in txt, CSV, and directory handling

This commit is contained in:
Lucien Greathouse
2019-10-09 12:55:24 -07:00
parent 28156bcaf2
commit 9f947ae2c5
3 changed files with 18 additions and 7 deletions

View File

@@ -8,6 +8,7 @@ use crate::{
};
use super::{
error::SnapshotError,
middleware::{SnapshotFileResult, SnapshotInstanceResult, SnapshotMiddleware},
snapshot_from_imfs, snapshot_from_instance,
};
@@ -38,7 +39,7 @@ impl SnapshotMiddleware for SnapshotDir {
.file_name()
.expect("Could not extract file name")
.to_str()
.unwrap()
.ok_or_else(|| SnapshotError::file_name_bad_unicode(entry.path()))?
.to_string();
Ok(Some(InstanceSnapshot {