Skip to content

Commit

Permalink
dns: catch and log root server plugin middleware errors
Browse files Browse the repository at this point in the history
  • Loading branch information
pinheadmz committed Feb 18, 2021
1 parent 3852599 commit aeddc56
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion lib/dns/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -334,7 +334,15 @@ class RootServer extends DNSServer {
// is able to return an authoritative (non-referral) answer.
let data = null;
if (typeof this.middle === 'function') {
data = await this.middle(tld, req);
try {
data = await this.middle(tld, req);
} catch (e) {
this.logger.error(
'Root server middleware resolution failed for name %s: %s',
name,
e.message
);
}

// Middleware function did an entire lookup on its own.
// Despite the variable name this must be a `Message` object,
Expand Down

0 comments on commit aeddc56

Please sign in to comment.