summaryrefslogtreecommitdiffstats
path: root/src/error.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/error.rs')
-rw-r--r--src/error.rs10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/error.rs b/src/error.rs
index a60843c..ac47fc8 100644
--- a/src/error.rs
+++ b/src/error.rs
@@ -30,6 +30,11 @@ pub enum Error {
Invalid(String),
#[error("blocked: {0}")]
Blocked(String),
+ /// A failure the outside world caused and a retry may clear: an unreachable
+ /// upstream, a half-written mirror. Distinct from a deterministic failure,
+ /// which must never be retried into a different answer (§8.4).
+ #[error("transient: {0}")]
+ Transient(String),
#[error("{0}")]
Other(String),
}
@@ -59,11 +64,14 @@ impl Error {
pub fn other(s: impl fmt::Display) -> Self {
Error::Other(s.to_string())
}
+ pub fn transient(s: impl fmt::Display) -> Self {
+ Error::Transient(s.to_string())
+ }
/// True when a retry could plausibly help (network, mirror 5xx). Deterministic
/// build failures must not auto-retry (§8.4).
pub fn is_transient(&self) -> bool {
- matches!(self, Error::Http(_) | Error::Io(_))
+ matches!(self, Error::Http(_) | Error::Io(_) | Error::Transient(_))
}
}