Skip to main content

pacenotes_installer\zip/
zip_error.rs

1/// Readable as-is by the user.
2#[derive(Debug)]
3pub struct ZipError(pub String);
4
5impl std::fmt::Display for ZipError {
6    fn fmt(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
7        formatter.write_str(&self.0)
8    }
9}
10
11impl ZipError {
12    pub(super) fn new(message: impl Into<String>) -> ZipError {
13        ZipError(message.into())
14    }
15
16    pub(super) fn truncated() -> ZipError {
17        ZipError::new("this package is damaged (it ends in the middle of a record)")
18    }
19}