This commit is contained in:
2022-06-19 13:31:55 +00:00
committed by GitHub
parent 3a35c88c5f
commit ec963d2438
4 changed files with 65 additions and 1 deletions

View File

@@ -36,3 +36,22 @@ macro_rules! concat_pixiv_downloader_error {
}
};
}
#[macro_export]
macro_rules! concat_error {
($exp1:expr, $exp2:expr, $typ:ty) => {
$exp1 = match $exp1 {
Ok(x) => match $exp2 {
Ok(_) => Ok(x),
Err(e) => Err(<$typ>::from(e)),
},
Err(e) => match $exp2 {
Ok(_) => Err(e),
Err(e2) => {
println!("{}", e);
Err(<$typ>::from(e2))
}
},
}
};
}