summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--cli/tests/resolve_dns.ts6
-rw-r--r--cli/tests/resolve_dns.ts.out1
-rw-r--r--runtime/ops/net.rs3
3 files changed, 9 insertions, 1 deletions
diff --git a/cli/tests/resolve_dns.ts b/cli/tests/resolve_dns.ts
index 35abfc803..7865d9680 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 10bd78e8a..78381e6c6 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 aa97be00b..e3864b38a 100644
--- a/runtime/ops/net.rs
+++ b/runtime/ops/net.rs
@@ -629,7 +629,8 @@ async fn op_dns_resolve(
let results: Vec<DnsReturnRecord> = 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();