summaryrefslogtreecommitdiffstats
path: root/src/error.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/error.rs')
-rw-r--r--src/error.rs33
1 files changed, 1 insertions, 32 deletions
diff --git a/src/error.rs b/src/error.rs
index 737dce1..51a2c24 100644
--- a/src/error.rs
+++ b/src/error.rs
@@ -1,12 +1,6 @@
use std::fmt;
/// What a lookup asked for and did not get.
-///
-/// Carried as data rather than a sentence, because "not found" is not one
-/// failure: a pkgbase nobody subscribed to is a 404 page, while a missing repo
-/// row means the install was never initialised and every page is wrong. A
-/// caller can tell those apart from the variant instead of re-reading prose the
-/// call site wrote for it.
#[derive(Debug, Clone, PartialEq, Eq)]
pub enum Missing {
Pkgbase(String),
@@ -36,12 +30,6 @@ impl fmt::Display for Missing {
}
/// An operation the current state of the world refuses.
-///
-/// The three shapes are the ones the state machines and the publish path
-/// actually produce. `IllegalTransition` is a bug in the caller — it asked for
-/// a move no edge permits; `WrongState` is a stale view — the caller was right
-/// once and the row moved; `PointerMoved` is a lost race, which is the one a
-/// client can safely retry.
#[derive(Debug, Clone, PartialEq, Eq)]
pub enum Refused {
/// No edge in the state machine leads from `from` to `to`.
@@ -73,10 +61,6 @@ impl fmt::Display for Refused {
/// A guard the code holds against itself: a value that was checked once must
/// still be that value where it is used.
-///
-/// These are not user errors. Nothing downstream recovers from one; the point
-/// of naming them is that a build that trips one stops rather than publishing
-/// bytes nobody approved.
#[derive(Debug, Clone, PartialEq, Eq)]
pub enum Guard {
/// A hash recomputed at use time differs from the one approved.
@@ -122,10 +106,7 @@ impl fmt::Display for WorldGap {
}
}
-/// The sandbox pool is at its quota.
-///
-/// Carries which backend said so, because the two have different remedies: a
-/// Kubernetes quota needs an operator, a local cap clears when a build exits.
+/// The sandbox pool is at its quota, and which backend said so.
#[derive(Debug, Clone, PartialEq, Eq)]
pub enum PoolFull {
Backend { backend: &'static str, detail: String },
@@ -142,9 +123,6 @@ impl fmt::Display for PoolFull {
}
/// A failure a retry is allowed to treat as worth another attempt.
-///
-/// The variant is the whole of the retry decision — `is_transient` reads it
-/// directly — so it carries where the failure came from rather than a message.
#[derive(Debug, Clone, PartialEq, Eq)]
pub enum TransientCause {
/// An upstream fetch that a moment might fix.
@@ -349,8 +327,6 @@ mod tests {
#[test]
fn the_six_behavioural_variants_carry_data_not_prose() {
- // Each of these is branched on somewhere, so the branch must be able to
- // read a field rather than re-parse a sentence it wrote itself.
match Error::not_found(Missing::RepoRow) {
Error::NotFound(Missing::RepoRow) => {}
other => panic!("repo row not-found came back as {other:?}"),
@@ -387,8 +363,6 @@ mod tests {
#[test]
fn a_typed_refusal_keeps_the_text_the_ui_and_tests_match_on() {
- // These strings are load-bearing: tests assert on them and a reviewer
- // reads them. Typing the payload must not silently reword them.
let e = Error::conflict(Refused::IllegalTransition {
entity: "candidate",
id: "7".into(),
@@ -408,8 +382,6 @@ mod tests {
#[test]
fn a_missing_thing_is_distinguishable_from_a_refused_one() {
- // Both were `Variant(String)`; a handler could only tell them apart by
- // prefix. Now the shape decides.
assert!(matches!(Error::not_found(Missing::RepoRow), Error::NotFound(_)));
assert!(!matches!(Error::not_found(Missing::RepoRow), Error::Conflict(_)));
assert!(matches!(Error::conflict(Refused::Other("no".into())), Error::Conflict(_)));
@@ -417,9 +389,6 @@ mod tests {
#[test]
fn a_call_site_that_cannot_structure_its_reason_still_compiles() {
- // The `From<&str>` arms exist so typing is incremental: a guard that is
- // genuinely just a sentence lands in Invariant/Other rather than
- // blocking the refactor.
assert!(matches!(
Error::fail_closed("no aur_commit on the source identity"),
Error::FailClosed(Guard::Invariant(_))