13
13
const {
14
14
ArrayIsArray,
15
15
Error,
16
+ ErrorCaptureStackTrace,
16
17
ErrorPrototypeToString,
17
18
JSONStringify,
18
19
Map,
@@ -302,8 +303,7 @@ function hideStackFrames(fn) {
302
303
function addCodeToName ( err , name , code ) {
303
304
// Set the stack
304
305
if ( excludedStackFn !== undefined ) {
305
- // eslint-disable-next-line no-restricted-syntax
306
- Error . captureStackTrace ( err , excludedStackFn ) ;
306
+ ErrorCaptureStackTrace ( err , excludedStackFn ) ;
307
307
}
308
308
// Add the error code to the name to include it in the stack trace.
309
309
err . name = `${ name } [${ code } ]` ;
@@ -439,9 +439,7 @@ function uvException(ctx) {
439
439
if ( dest ) {
440
440
err . dest = dest ;
441
441
}
442
-
443
- // eslint-disable-next-line no-restricted-syntax
444
- Error . captureStackTrace ( err , excludedStackFn || uvException ) ;
442
+ ErrorCaptureStackTrace ( err , excludedStackFn || uvException ) ;
445
443
return err ;
446
444
}
447
445
@@ -482,9 +480,7 @@ function uvExceptionWithHostPort(err, syscall, address, port) {
482
480
if ( port ) {
483
481
ex . port = port ;
484
482
}
485
-
486
- // eslint-disable-next-line no-restricted-syntax
487
- Error . captureStackTrace ( ex , excludedStackFn || uvExceptionWithHostPort ) ;
483
+ ErrorCaptureStackTrace ( ex , excludedStackFn || uvExceptionWithHostPort ) ;
488
484
return ex ;
489
485
}
490
486
@@ -511,9 +507,7 @@ function errnoException(err, syscall, original) {
511
507
ex . errno = err ;
512
508
ex . code = code ;
513
509
ex . syscall = syscall ;
514
-
515
- // eslint-disable-next-line no-restricted-syntax
516
- Error . captureStackTrace ( ex , excludedStackFn || errnoException ) ;
510
+ ErrorCaptureStackTrace ( ex , excludedStackFn || errnoException ) ;
517
511
return ex ;
518
512
}
519
513
@@ -560,9 +554,7 @@ function exceptionWithHostPort(err, syscall, address, port, additional) {
560
554
if ( port ) {
561
555
ex . port = port ;
562
556
}
563
-
564
- // eslint-disable-next-line no-restricted-syntax
565
- Error . captureStackTrace ( ex , excludedStackFn || exceptionWithHostPort ) ;
557
+ ErrorCaptureStackTrace ( ex , excludedStackFn || exceptionWithHostPort ) ;
566
558
return ex ;
567
559
}
568
560
@@ -606,9 +598,7 @@ function dnsException(code, syscall, hostname) {
606
598
if ( hostname ) {
607
599
ex . hostname = hostname ;
608
600
}
609
-
610
- // eslint-disable-next-line no-restricted-syntax
611
- Error . captureStackTrace ( ex , excludedStackFn || dnsException ) ;
601
+ ErrorCaptureStackTrace ( ex , excludedStackFn || dnsException ) ;
612
602
return ex ;
613
603
}
614
604
0 commit comments