Skip to content

Commit

Permalink
keep going on error
Browse files Browse the repository at this point in the history
Just log the error instead of quiting the application.
  • Loading branch information
nrdxp committed Aug 16, 2022
1 parent fffede0 commit 24a3d8e
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
8 changes: 4 additions & 4 deletions src/deploy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
//
// SPDX-License-Identifier: MPL-2.0

use log::{debug, info};
use log::{debug, error, info};
use thiserror::Error;
use tokio::process::Command;

Expand Down Expand Up @@ -316,7 +316,7 @@ pub async fn confirm_profile(

match ssh_confirm_cmd_handle.status.code() {
Some(0) => (),
a => return Err(ConfirmProfileError::SSHConfirmExit(a)),
a => error!("{}", ConfirmProfileError::SSHConfirmExit(a)),
};

info!("Deployment confirmed.");
Expand Down Expand Up @@ -375,7 +375,7 @@ pub async fn deploy_profile(

match ssh_activate_cmd_handle.status.code() {
Some(0) => (),
a => return Err(DeployProfileError::SSHActivateExit(a)),
a => error!("{}", DeployProfileError::SSHActivateExit(a)),
};

if *dry_activate {
Expand Down Expand Up @@ -418,7 +418,7 @@ pub async fn deploy_profile(
debug!("Wait command ended");
match x.map_err(DeployProfileError::SSHWait)?.status.code() {
Some(0) => (),
a => return Err(DeployProfileError::SSHWaitExit(a)),
a => error!("{}",DeployProfileError::SSHWaitExit(a)),
};
},
x = recv_activate => {
Expand Down
12 changes: 6 additions & 6 deletions src/push.rs
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ pub async fn push_profile(

match show_derivation_output.status.code() {
Some(0) => (),
a => return Err(PushProfileError::ShowDerivationExit(a)),
a => error!("{}", PushProfileError::ShowDerivationExit(a)),
};

let derivation_info: HashMap<&str, serde_json::value::Value> = serde_json::from_str(
Expand Down Expand Up @@ -246,15 +246,15 @@ pub async fn push_profile(

match build_cmd_handle.map_err(PushProfileError::Build)?.code() {
Some(0) => (),
a => return Err(PushProfileError::BuildExit(a)),
a => error!("{}", PushProfileError::BuildExit(a)),
};

if !Path::new(format!("{}/deploy-rs-activate", closure).as_str()).exists() {
return Err(PushProfileError::DeployRsActivateDoesntExist);
error!("{}", PushProfileError::DeployRsActivateDoesntExist);
}

if !Path::new(format!("{}/activate-rs", closure).as_str()).exists() {
return Err(PushProfileError::ActivateRsDoesntExist);
error!("{}", PushProfileError::ActivateRsDoesntExist);
}

if let Ok(local_key) = std::env::var("LOCAL_KEY") {
Expand All @@ -268,7 +268,7 @@ pub async fn push_profile(

match sign_cmd_handle.status.code() {
Some(0) => (),
a => return Err(PushProfileError::SignExit(a)),
a => error!("{}", PushProfileError::SignExit(a)),
};
}

Expand All @@ -284,7 +284,7 @@ pub async fn push_profile(

match copy_exit_cmd_handle.map_err(PushProfileError::Copy)?.code() {
Some(0) => (),
a => return Err(PushProfileError::CopyExit(a)),
a => error!("{}", PushProfileError::CopyExit(a)),
};

Ok(())
Expand Down

0 comments on commit 24a3d8e

Please sign in to comment.