1313const {
1414 ArrayIsArray,
1515 Error,
16+ ErrorCaptureStackTrace,
1617 ErrorPrototypeToString,
1718 JSONStringify,
1819 Map,
@@ -306,8 +307,7 @@ function hideStackFrames(fn) {
306307function addCodeToName ( err , name , code ) {
307308 // Set the stack
308309 if ( excludedStackFn !== undefined ) {
309- // eslint-disable-next-line no-restricted-syntax
310- Error . captureStackTrace ( err , excludedStackFn ) ;
310+ ErrorCaptureStackTrace ( err , excludedStackFn ) ;
311311 }
312312 // Add the error code to the name to include it in the stack trace.
313313 err . name = `${ name } [${ code } ]` ;
@@ -443,9 +443,7 @@ function uvException(ctx) {
443443 if ( dest ) {
444444 err . dest = dest ;
445445 }
446-
447- // eslint-disable-next-line no-restricted-syntax
448- Error . captureStackTrace ( err , excludedStackFn || uvException ) ;
446+ ErrorCaptureStackTrace ( err , excludedStackFn || uvException ) ;
449447 return err ;
450448}
451449
@@ -486,9 +484,7 @@ function uvExceptionWithHostPort(err, syscall, address, port) {
486484 if ( port ) {
487485 ex . port = port ;
488486 }
489-
490- // eslint-disable-next-line no-restricted-syntax
491- Error . captureStackTrace ( ex , excludedStackFn || uvExceptionWithHostPort ) ;
487+ ErrorCaptureStackTrace ( ex , excludedStackFn || uvExceptionWithHostPort ) ;
492488 return ex ;
493489}
494490
@@ -515,9 +511,7 @@ function errnoException(err, syscall, original) {
515511 ex . errno = err ;
516512 ex . code = code ;
517513 ex . syscall = syscall ;
518-
519- // eslint-disable-next-line no-restricted-syntax
520- Error . captureStackTrace ( ex , excludedStackFn || errnoException ) ;
514+ ErrorCaptureStackTrace ( ex , excludedStackFn || errnoException ) ;
521515 return ex ;
522516}
523517
@@ -564,9 +558,7 @@ function exceptionWithHostPort(err, syscall, address, port, additional) {
564558 if ( port ) {
565559 ex . port = port ;
566560 }
567-
568- // eslint-disable-next-line no-restricted-syntax
569- Error . captureStackTrace ( ex , excludedStackFn || exceptionWithHostPort ) ;
561+ ErrorCaptureStackTrace ( ex , excludedStackFn || exceptionWithHostPort ) ;
570562 return ex ;
571563}
572564
@@ -610,9 +602,7 @@ function dnsException(code, syscall, hostname) {
610602 if ( hostname ) {
611603 ex . hostname = hostname ;
612604 }
613-
614- // eslint-disable-next-line no-restricted-syntax
615- Error . captureStackTrace ( ex , excludedStackFn || dnsException ) ;
605+ ErrorCaptureStackTrace ( ex , excludedStackFn || dnsException ) ;
616606 return ex ;
617607}
618608
0 commit comments