- Removed redundant http head requests that were used to query filesizes, even after the filesize was known already.
27 lines
683 B
Rust
27 lines
683 B
Rust
use std::error::Error;
|
|
use std::fmt::{ self, Display, Formatter };
|
|
|
|
/// Result Boxed Error
|
|
pub type ResBE<T> = Result<T, Box<dyn Error>>;
|
|
|
|
#[allow(unused)]
|
|
#[derive(Clone, Debug)]
|
|
pub enum DlError {
|
|
BadHttpStatus,
|
|
ContentLengthUnknown,
|
|
Other(String)
|
|
}
|
|
|
|
impl Error for DlError {}
|
|
|
|
impl Display for DlError {
|
|
|
|
fn fmt(&self, f: &mut Formatter<'_>) -> fmt::Result {
|
|
match self {
|
|
DlError::BadHttpStatus => write!(f, "Bad http response status"),
|
|
DlError::ContentLengthUnknown => write!(f, "Content-Length is unknown"),
|
|
DlError::Other(s) => write!(f, "Unknown download error: '{}'", s)
|
|
}
|
|
}
|
|
|
|
} |