commitstatuserror: handle each error case separately, not based on 'internal' error

This commit is contained in:
Graham Christensen 2020-04-07 08:14:02 -04:00
parent 8e6f78607b
commit e65a24aa89
No known key found for this signature in database
GPG key ID: FE918C3A98C1030F
2 changed files with 6 additions and 13 deletions

View file

@ -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<hubcaps::Error> for CommitStatusError {
fn from(e: hubcaps::Error) -> CommitStatusError {
use hyper::status::StatusCode;

View file

@ -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