diff --git a/cli/tests/resolve_dns.ts b/cli/tests/resolve_dns.ts index 35abfc8039..7865d9680a 100644 --- a/cli/tests/resolve_dns.ts +++ b/cli/tests/resolve_dns.ts @@ -34,3 +34,9 @@ console.log(JSON.stringify(srv)); console.log("TXT"); console.log(JSON.stringify(txt)); + +try { + await Deno.resolveDns("not-found-example.com", "A", nameServer); +} catch (e) { + console.log("Error thrown for not-found-example.com"); +} diff --git a/cli/tests/resolve_dns.ts.out b/cli/tests/resolve_dns.ts.out index 10bd78e8a2..78381e6c61 100644 --- a/cli/tests/resolve_dns.ts.out +++ b/cli/tests/resolve_dns.ts.out @@ -14,3 +14,4 @@ SRV [{"priority":0,"weight":100,"port":1234,"target":"srv.com."}] TXT [["foo","bar"]] +Error thrown for not-found-example.com diff --git a/runtime/ops/net.rs b/runtime/ops/net.rs index aa97be00b0..e3864b38a7 100644 --- a/runtime/ops/net.rs +++ b/runtime/ops/net.rs @@ -629,7 +629,8 @@ async fn op_dns_resolve( let results: Vec = resolver .lookup(query, record_type, Default::default()) - .await? + .await + .map_err(|e| generic_error(format!("{}", e)))? .iter() .filter_map(rdata_to_return_record(record_type)) .collect();