1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2024-12-23 15:49:44 -05:00

fix(ops/net): fix panic in op_dns_resolve (#9187)

This commit is contained in:
Yoshiya Hinosawa 2021-01-20 23:47:17 +09:00 committed by GitHub
parent ffb4b32e92
commit 0a159bea15
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 9 additions and 1 deletions

View file

@ -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");
}

View file

@ -14,3 +14,4 @@ SRV
[{"priority":0,"weight":100,"port":1234,"target":"srv.com."}]
TXT
[["foo","bar"]]
Error thrown for not-found-example.com

View file

@ -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();