diff --git a/crates/dns-resolver/src/lib.rs b/crates/dns-resolver/src/lib.rs index 60c8c3b0..b2d0e61e 100644 --- a/crates/dns-resolver/src/lib.rs +++ b/crates/dns-resolver/src/lib.rs @@ -30,7 +30,7 @@ static IP_CACHE: LazyLock>>>> = #[cfg(feature = "default-unbound")] fn default_resolver() -> Resolver { - Resolver::Unbound(UnboundResolver::new()) + Resolver::Unbound(UnboundResolver::new().unwrap()) } #[cfg(not(feature = "default-unbound"))] diff --git a/crates/dns-resolver/src/resolver.rs b/crates/dns-resolver/src/resolver.rs index 059702ae..41725992 100644 --- a/crates/dns-resolver/src/resolver.rs +++ b/crates/dns-resolver/src/resolver.rs @@ -54,14 +54,14 @@ pub struct UnboundResolver { #[cfg(feature = "unbound")] impl UnboundResolver { - pub fn new() -> Self { + pub fn new() -> Result { // This resolves directly against the root - let context = Context::new().unwrap(); + let context = Context::new()?; // and enables DNSSEC - context.add_builtin_trust_anchors().unwrap(); - Self { - cx: context.into_async().unwrap(), - } + context.add_builtin_trust_anchors()?; + Ok(Self { + cx: context.into_async()?, + }) } }