summaryrefslogtreecommitdiffstats
path: root/src/db/candidates.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/db/candidates.rs')
-rw-r--r--src/db/candidates.rs6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/db/candidates.rs b/src/db/candidates.rs
index df145ac..10d39bf 100644
--- a/src/db/candidates.rs
+++ b/src/db/candidates.rs
@@ -1,7 +1,7 @@
use rusqlite::{params, OptionalExtension, Row, Transaction};
use crate::db::{CandidateRow, CandidateState, Db};
-use crate::error::{Error, Result};
+use crate::error::{Error, Missing, Refused, Result};
use crate::time;
const CANDIDATE_COLS: &str = "c.id, c.pkgbase_id, c.base_release_id, c.kind, c.snapshot_id, c.epoch, c.pkgver, \
@@ -123,8 +123,8 @@ pub fn resolve_in(tx: &Transaction<'_>, id: i64, to: CandidateState, at: &str) -
.query_row("SELECT state FROM candidate WHERE id=?1", params![id], |r| r.get(0))
.optional()?;
return Err(match was {
- Some(w) => Error::conflict(format!("illegal candidate transition {w} → {to} for review {id}")),
- None => Error::not_found(format!("no candidate {id} to resolve")),
+ Some(w) => Error::conflict(Refused::IllegalTransition { entity: "candidate", id: id.to_string(), from: w, to: to.to_string() }),
+ None => Error::not_found(Missing::Candidate(id)),
});
}
Ok(())