diff --git a/src/result.rs b/src/result.rs index 00d558cb4..0f295436a 100644 --- a/src/result.rs +++ b/src/result.rs @@ -78,7 +78,14 @@ impl ZipError { impl From for io::Error { fn from(err: ZipError) -> io::Error { - io::Error::new(io::ErrorKind::Other, err) + let kind = match &err { + ZipError::Io(err) => err.kind(), + ZipError::InvalidArchive(_) => io::ErrorKind::InvalidData, + ZipError::UnsupportedArchive(_) => io::ErrorKind::Unsupported, + ZipError::FileNotFound => io::ErrorKind::NotFound, + }; + + io::Error::new(kind, err) } }