From e65a24aa89edb7f8948b3b0e997d722128cde7e7 Mon Sep 17 00:00:00 2001 From: Graham Christensen Date: Tue, 7 Apr 2020 08:14:02 -0400 Subject: [PATCH] commitstatuserror: handle each error case separately, not based on 'internal' error --- ofborg/src/commitstatus.rs | 9 --------- ofborg/src/tasks/evaluate.rs | 10 ++++++---- 2 files changed, 6 insertions(+), 13 deletions(-) diff --git a/ofborg/src/commitstatus.rs b/ofborg/src/commitstatus.rs index fb56db0..d12b5c3 100644 --- a/ofborg/src/commitstatus.rs +++ b/ofborg/src/commitstatus.rs @@ -75,15 +75,6 @@ pub enum CommitStatusError { Error(hubcaps::Error), } -impl CommitStatusError { - pub fn is_internal_error(&self) -> bool { - match self { - CommitStatusError::MissingSHA(_) => false, - CommitStatusError::Error(_) => true, - } - } -} - impl From for CommitStatusError { fn from(e: hubcaps::Error) -> CommitStatusError { use hyper::status::StatusCode; diff --git a/ofborg/src/tasks/evaluate.rs b/ofborg/src/tasks/evaluate.rs index e0d6c6a..965ad55 100644 --- a/ofborg/src/tasks/evaluate.rs +++ b/ofborg/src/tasks/evaluate.rs @@ -226,13 +226,15 @@ impl<'a, E: stats::SysEvents + 'static> OneEval<'a, E> { self.actions().skip(&self.job) } - Err(Err(cswerr)) if !cswerr.is_internal_error() => { - error!("Ignorable error writing commit status: {:?}", cswerr); - + Err(Err(CommitStatusError::MissingSHA(e))) => { + error!( + "Failed writing commit status: commit sha was force-pushed away: {:?}", + e + ); self.actions().skip(&self.job) } - Err(Err(cswerr)) => { + Err(Err(CommitStatusError::Error(cswerr))) => { error!( "Internal error writing commit status: {:?}, marking internal error", cswerr