You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
25 lines
567 B
25 lines
567 B
use std::io;
|
|
|
|
#[derive(Debug)]
|
|
pub enum UnpackError {
|
|
Io(io::Error),
|
|
Parsing(String),
|
|
Compression(String),
|
|
Naming(String),
|
|
Unknown(String),
|
|
}
|
|
|
|
impl UnpackError {
|
|
pub fn parsing_err(filetype: &str, kind: nom::error::ErrorKind) -> UnpackError {
|
|
let reason = format!("{:?} {:?}", kind, kind.description());
|
|
let message = format!("{} parsing failed: ", filetype);
|
|
UnpackError::Parsing(message + &reason)
|
|
}
|
|
}
|
|
|
|
impl From<io::Error> for UnpackError {
|
|
fn from(e: io::Error) -> Self {
|
|
UnpackError::Io(e)
|
|
}
|
|
}
|