reject lookup when all resolutions reject

This commit is contained in:
gkampitakis 2024-07-09 19:57:47 +01:00
parent 2a9f8f4c40
commit 3aaf0c6e52
No known key found for this signature in database
1 changed files with 4 additions and 0 deletions

View File

@ -302,6 +302,10 @@ class DnsResolver implements Resolver {
this.independentResolver.resolve6(hostname),
]);
if (records.every(result => result.status === 'rejected')) {
throw new Error((records[0] as PromiseRejectedResult).reason);
}
return records
.reduce<string[]>((acc, result) => {
return result.status === 'fulfilled'