diff options
author | Teddy Wing | 2017-11-11 22:49:04 +0100 |
---|---|---|
committer | Teddy Wing | 2017-11-11 22:49:04 +0100 |
commit | b9d225974d9be1ded1ee0b47d8025916edd5736c (patch) | |
tree | dc9b2f7d19d7e3a56224412b2bad608678704305 | |
parent | 7b62d76be439e11db52933d9f168d6f3ac5691c5 (diff) | |
download | kipper-b9d225974d9be1ded1ee0b47d8025916edd5736c.tar.bz2 |
find_and_track_build_and_update_status(): Use `Result`s
Catch `Result` errors in the spawned thread by panicking with `expect`.
Couldn't figure out how to use `expect` with a custom value, in the case
of `request_job`.
-rw-r--r-- | src/jenkins.rs | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/src/jenkins.rs b/src/jenkins.rs index 5ee36de..024f7f7 100644 --- a/src/jenkins.rs +++ b/src/jenkins.rs @@ -102,7 +102,7 @@ pub fn find_and_track_build_and_update_status(commit_ref: CommitRef) job_url.clone(), None, "continuous-integration/jenkins".to_string() - ); + ).expect("GitHub pending status update failed."); while job.result == JobStatus::Pending { // loop @@ -122,14 +122,18 @@ pub fn find_and_track_build_and_update_status(commit_ref: CommitRef) job_url.clone(), Some("The status checker timed out.".to_string()), "continuous-integration/jenkins".to_string() - ); + ).expect("GitHub timeout error status update failed."); return } sleep(Duration::from_secs(30)); - let updated_job = request_job(job_url.as_ref()).unwrap(); + let updated_job = request_job( + job_url.as_ref() + ).expect( + format!("Failed to request job '{}'.", job_url).as_ref() + ); if job.result != updated_job.result { github::update_commit_status( @@ -138,7 +142,7 @@ pub fn find_and_track_build_and_update_status(commit_ref: CommitRef) job_url.clone(), None, "continuous-integration/jenkins".to_string() - ); + ).expect("GitHub status update failed."); return } |