initial commit
This commit is contained in:
commit
53739b78f9
13 changed files with 3272 additions and 0 deletions
33
src/error.rs
Normal file
33
src/error.rs
Normal file
|
@ -0,0 +1,33 @@
|
|||
#[derive(Debug)]
|
||||
/// Convert different errors into a common one.
|
||||
pub enum EcloadError {
|
||||
Error(String),
|
||||
StdError(std::io::Error),
|
||||
ReqwestError(reqwest::Error),
|
||||
PrintPdfError(printpdf::Error),
|
||||
ImageError(image::ImageError),
|
||||
}
|
||||
|
||||
impl From<std::io::Error> for EcloadError {
|
||||
fn from(e: std::io::Error) -> Self {
|
||||
EcloadError::StdError(e)
|
||||
}
|
||||
}
|
||||
|
||||
impl From<reqwest::Error> for EcloadError {
|
||||
fn from(e: reqwest::Error) -> Self {
|
||||
EcloadError::ReqwestError(e)
|
||||
}
|
||||
}
|
||||
|
||||
impl From<printpdf::Error> for EcloadError {
|
||||
fn from(e: printpdf::Error) -> Self {
|
||||
EcloadError::PrintPdfError(e)
|
||||
}
|
||||
}
|
||||
|
||||
impl From<image::ImageError> for EcloadError {
|
||||
fn from(e: image::ImageError) -> Self {
|
||||
EcloadError::ImageError(e)
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue