Skip to content

Commit 8baaa25

Browse files
committed
dns: use template literals
Prefer the use of template string literals over string concatenation in the dns module, makes dns consistent with other modules basically doing #5778 for it. PR-URL: #5809 Reviewed-By: James M Snell <jasnell@gmail.com>
1 parent c979a2d commit 8baaa25

1 file changed

Lines changed: 5 additions & 5 deletions

File tree

‎lib/dns.js‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,8 @@ function errnoException(err, syscall, hostname) {
2424
}
2525
varex=null;
2626
if(typeoferr==='string'){// c-ares error code.
27-
ex=newError(syscall+' '+err+(hostname ? ' '+hostname : ''));
27+
consterrHost=hostname ? ' '+hostname : '';
28+
ex=newError(`${syscall}${err}${errHost}`);
2829
ex.code=err;
2930
ex.errno=err;
3031
ex.syscall=syscall;
@@ -271,7 +272,7 @@ exports.resolve = function(hostname, type_, callback_) {
271272
if(typeofresolver==='function'){
272273
returnresolver(hostname,callback);
273274
}else{
274-
thrownewError('Unknown type "'+type_+'"');
275+
thrownewError(`Unknown type "${type_}"`);
275276
}
276277
};
277278

@@ -309,7 +310,7 @@ exports.setServers = function(servers) {
309310
if(ver)
310311
returnnewSet.push([ver,s]);
311312

312-
thrownewError('IP address is not properly formatted: '+serv);
313+
thrownewError(`IP address is not properly formatted: ${serv}`);
313314
});
314315

315316
varr=cares.setServers(newSet);
@@ -319,8 +320,7 @@ exports.setServers = function(servers) {
319320
cares.setServers(orig.join(','));
320321

321322
varerr=cares.strerror(r);
322-
thrownewError('c-ares failed to set servers: "'+err+
323-
'" ['+servers+']');
323+
thrownewError(`c-ares failed to set servers: "${err}" [${servers}]`);
324324
}
325325
};
326326

0 commit comments

Comments
 (0)