fix(domain): from_db_str returns Result — unknown DB values are errors not silent defaults

This commit is contained in:
2026-05-15 13:57:38 +02:00
parent 5a64dd361c
commit f697267828
7 changed files with 75 additions and 39 deletions

View File

@@ -35,11 +35,14 @@ impl FollowState {
}
}
pub fn from_db_str(s: &str) -> Self {
pub fn from_db_str(s: &str) -> Result<Self, crate::errors::DomainError> {
match s {
"pending" => Self::Pending,
"rejected" => Self::Rejected,
_ => Self::Accepted,
"pending" => Ok(Self::Pending),
"accepted" => Ok(Self::Accepted),
"rejected" => Ok(Self::Rejected),
other => Err(crate::errors::DomainError::Internal(format!(
"unknown follow_state: '{other}'"
))),
}
}
}