mirror of
https://github.com/cargo-bins/cargo-binstall.git
synced 2025-04-21 13:08:42 +00:00
Construct BinstallError
from JoinError
in main
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
This commit is contained in:
parent
6e5ecc46cf
commit
d39bc0acab
1 changed files with 10 additions and 7 deletions
17
src/main.rs
17
src/main.rs
|
@ -172,13 +172,16 @@ fn main() -> MainExit {
|
|||
let done = start.elapsed();
|
||||
debug!("run time: {done:?}");
|
||||
|
||||
result.map_or_else(MainExit::JoinErr, |res| {
|
||||
res.map(|_| MainExit::Success(done)).unwrap_or_else(|err| {
|
||||
err.downcast::<BinstallError>()
|
||||
.map(MainExit::Error)
|
||||
.unwrap_or_else(MainExit::Report)
|
||||
})
|
||||
})
|
||||
result.map_or_else(
|
||||
|join_err| MainExit::Error(BinstallError::from(join_err)),
|
||||
|res| {
|
||||
res.map(|_| MainExit::Success(done)).unwrap_or_else(|err| {
|
||||
err.downcast::<BinstallError>()
|
||||
.map(MainExit::Error)
|
||||
.unwrap_or_else(MainExit::Report)
|
||||
})
|
||||
},
|
||||
)
|
||||
}
|
||||
|
||||
async fn entry(jobserver_client: LazyJobserverClient) -> Result<()> {
|
||||
|
|
Loading…
Add table
Reference in a new issue