Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dns: use template literals #5809

Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions lib/dns.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@ function errnoException(err, syscall, hostname) {
}
var ex = null;
if (typeof err === 'string') { // c-ares error code.
ex = new Error(syscall + ' ' + err + (hostname ? ' ' + hostname : ''));
const errHost = hostname ? ' ' + hostname : '';
ex = new Error(`${syscall} ${err}${errHost}`);
ex.code = err;
ex.errno = err;
ex.syscall = syscall;
Expand Down Expand Up @@ -272,7 +273,7 @@ exports.resolve = function(hostname, type_, callback_) {
if (typeof resolver === 'function') {
return resolver(hostname, callback);
} else {
throw new Error('Unknown type "' + type_ + '"');
throw new Error(`Unknown type "${type_}"`);
}
};

Expand Down Expand Up @@ -310,7 +311,7 @@ exports.setServers = function(servers) {
if (ver)
return newSet.push([ver, s]);

throw new Error('IP address is not properly formatted: ' + serv);
throw new Error(`IP address is not properly formatted: ${serv}`);
});

var r = cares.setServers(newSet);
Expand All @@ -320,8 +321,7 @@ exports.setServers = function(servers) {
cares.setServers(orig.join(','));

var err = cares.strerror(r);
throw new Error('c-ares failed to set servers: "' + err +
'" [' + servers + ']');
throw new Error(`c-ares failed to set servers: "${err}" [${servers}]`);
}
};

Expand Down