pub enum ResolveError {
Network(String),
Timeout(u64),
Disabled,
NotFound(String),
Ambiguous {
query: String,
count: usize,
},
Parse(String),
}Expand description
Errors produced by a crate::Resolver.
Network/Timeout/Disabled are transient — degrade to seed+cache and
retry later (ResolveError::is_transient). NotFound/Ambiguous/Parse
are content misses: the query itself did not resolve, so an identical retry
produces the same result. A resolver reports a content miss as one of these
variants rather than returning a best-guess result in their place.
Clone/Eq let callers (e.g. a durable retry queue) retain the error
across attempts without re-running the request.
use simbad_resolver::ResolveError;
// Transport failures are worth retrying; content misses are not.
assert!(ResolveError::Network("connection reset".to_owned()).is_transient());
assert!(ResolveError::Timeout(10).is_transient());
assert!(!ResolveError::NotFound("not-an-object".to_owned()).is_transient());
assert!(!ResolveError::Ambiguous { query: "M".to_owned(), count: 3 }.is_transient());Variants§
Network(String)
Network/transport failure reaching the resolver backend; degrade to seed+cache.
Timeout(u64)
The request exceeded the configured timeout (seconds); degrade to seed+cache.
Disabled
Online resolution is disabled by configuration; seed+cache only.
NotFound(String)
The query did not resolve to any known object (unknown/garbled).
Ambiguous
The query resolved to multiple distinct physical objects; callers leave the item unresolved rather than guessing.
Parse(String)
The backend response could not be parsed into a canonical identity.
Implementations§
Source§impl ResolveError
impl ResolveError
Sourcepub fn is_transient(&self) -> bool
pub fn is_transient(&self) -> bool
Whether this error is transient (worth retrying later) as opposed to a content miss (the query itself does not resolve).
Trait Implementations§
Source§impl Clone for ResolveError
impl Clone for ResolveError
Source§impl Debug for ResolveError
impl Debug for ResolveError
Source§impl Display for ResolveError
impl Display for ResolveError
impl Eq for ResolveError
Source§impl Error for ResolveError
impl Error for ResolveError
1.30.0 · Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
use the Display impl or to_string()