13
13
const {
14
14
ArrayIsArray,
15
15
Error,
16
+ ErrorCaptureStackTrace,
16
17
ErrorPrototypeToString,
17
18
JSONStringify,
18
19
Map,
@@ -306,8 +307,7 @@ function hideStackFrames(fn) {
306
307
function addCodeToName ( err , name , code ) {
307
308
// Set the stack
308
309
if ( excludedStackFn !== undefined ) {
309
- // eslint-disable-next-line no-restricted-syntax
310
- Error . captureStackTrace ( err , excludedStackFn ) ;
310
+ ErrorCaptureStackTrace ( err , excludedStackFn ) ;
311
311
}
312
312
// Add the error code to the name to include it in the stack trace.
313
313
err . name = `${ name } [${ code } ]` ;
@@ -443,9 +443,7 @@ function uvException(ctx) {
443
443
if ( dest ) {
444
444
err . dest = dest ;
445
445
}
446
-
447
- // eslint-disable-next-line no-restricted-syntax
448
- Error . captureStackTrace ( err , excludedStackFn || uvException ) ;
446
+ ErrorCaptureStackTrace ( err , excludedStackFn || uvException ) ;
449
447
return err ;
450
448
}
451
449
@@ -486,9 +484,7 @@ function uvExceptionWithHostPort(err, syscall, address, port) {
486
484
if ( port ) {
487
485
ex . port = port ;
488
486
}
489
-
490
- // eslint-disable-next-line no-restricted-syntax
491
- Error . captureStackTrace ( ex , excludedStackFn || uvExceptionWithHostPort ) ;
487
+ ErrorCaptureStackTrace ( ex , excludedStackFn || uvExceptionWithHostPort ) ;
492
488
return ex ;
493
489
}
494
490
@@ -515,9 +511,7 @@ function errnoException(err, syscall, original) {
515
511
ex . errno = err ;
516
512
ex . code = code ;
517
513
ex . syscall = syscall ;
518
-
519
- // eslint-disable-next-line no-restricted-syntax
520
- Error . captureStackTrace ( ex , excludedStackFn || errnoException ) ;
514
+ ErrorCaptureStackTrace ( ex , excludedStackFn || errnoException ) ;
521
515
return ex ;
522
516
}
523
517
@@ -564,9 +558,7 @@ function exceptionWithHostPort(err, syscall, address, port, additional) {
564
558
if ( port ) {
565
559
ex . port = port ;
566
560
}
567
-
568
- // eslint-disable-next-line no-restricted-syntax
569
- Error . captureStackTrace ( ex , excludedStackFn || exceptionWithHostPort ) ;
561
+ ErrorCaptureStackTrace ( ex , excludedStackFn || exceptionWithHostPort ) ;
570
562
return ex ;
571
563
}
572
564
@@ -610,9 +602,7 @@ function dnsException(code, syscall, hostname) {
610
602
if ( hostname ) {
611
603
ex . hostname = hostname ;
612
604
}
613
-
614
- // eslint-disable-next-line no-restricted-syntax
615
- Error . captureStackTrace ( ex , excludedStackFn || dnsException ) ;
605
+ ErrorCaptureStackTrace ( ex , excludedStackFn || dnsException ) ;
616
606
return ex ;
617
607
}
618
608
0 commit comments