refactor: flag internally that dev not based on main will require used intervention

Preparation for when we will be sending user notifications
This commit is contained in:
Paul Campbell 2024-07-16 20:00:29 +01:00
parent 92ebd45307
commit ba67b1ebcb
3 changed files with 7 additions and 3 deletions

View file

@ -40,7 +40,7 @@ pub fn validate_positions(
// Validations:
// Dev must be on main branch, else the USER must rebase it
if is_not_based_on(&commit_histories.dev, &main) {
return Err(Error::NonRetryable(format!(
return Err(Error::UserIntervention(format!(
"Branch '{}' not based on '{}'",
dev_branch, main_branch
)));
@ -119,6 +119,9 @@ pub enum Error {
#[error("{0} - not retrying")]
NonRetryable(String),
#[error("{0} - user intervention required")]
UserIntervention(String),
}
impl From<git::fetch::Error> for Error {
fn from(value: git::fetch::Error) -> Self {

View file

@ -249,7 +249,7 @@ mod positions {
//then
assert!(matches!(
err,
git::validation::positions::Error::NonRetryable(_)
git::validation::positions::Error::UserIntervention(_)
));
}

View file

@ -97,7 +97,8 @@ impl Handler<actor::messages::ValidateRepo> for actor::RepoActor {
.into_actor(self)
.wait(ctx);
}
Err(git::validation::positions::Error::NonRetryable(message)) => {
Err(git::validation::positions::Error::NonRetryable(message))
| Err(git::validation::positions::Error::UserIntervention(message)) => {
actor::logger(&self.log, message);
}
}