@@ -10,16 +10,18 @@ const path = require('path');
10
10
const kArrowMessagePrivateSymbolIndex = binding [ 'arrow_message_private_symbol' ] ;
11
11
const kDecoratedPrivateSymbolIndex = binding [ 'decorated_private_symbol' ] ;
12
12
13
+ const decorateErrorStack = internalUtil . decorateErrorStack ;
14
+
13
15
assert . doesNotThrow ( function ( ) {
14
- internalUtil . decorateErrorStack ( ) ;
15
- internalUtil . decorateErrorStack ( null ) ;
16
- internalUtil . decorateErrorStack ( 1 ) ;
17
- internalUtil . decorateErrorStack ( true ) ;
16
+ decorateErrorStack ( ) ;
17
+ decorateErrorStack ( null ) ;
18
+ decorateErrorStack ( 1 ) ;
19
+ decorateErrorStack ( true ) ;
18
20
} ) ;
19
21
20
22
// Verify that a stack property is not added to non-Errors
21
23
const obj = { } ;
22
- internalUtil . decorateErrorStack ( obj ) ;
24
+ decorateErrorStack ( obj ) ;
23
25
assert . strictEqual ( obj . stack , undefined ) ;
24
26
25
27
// Verify that the stack is decorated when possible
@@ -43,8 +45,8 @@ assert(typeof err, 'object');
43
45
checkStack ( err . stack ) ;
44
46
45
47
// Verify that the stack is only decorated once
46
- internalUtil . decorateErrorStack ( err ) ;
47
- internalUtil . decorateErrorStack ( err ) ;
48
+ decorateErrorStack ( err ) ;
49
+ decorateErrorStack ( err ) ;
48
50
checkStack ( err . stack ) ;
49
51
50
52
// Verify that the stack is only decorated once for uncaught exceptions
@@ -58,7 +60,7 @@ checkStack(result.stderr);
58
60
// Verify that the stack is unchanged when there is no arrow message
59
61
err = new Error ( 'foo' ) ;
60
62
let originalStack = err . stack ;
61
- internalUtil . decorateErrorStack ( err ) ;
63
+ decorateErrorStack ( err ) ;
62
64
assert . strictEqual ( originalStack , err . stack ) ;
63
65
64
66
// Verify that the arrow message is added to the start of the stack when it
@@ -67,9 +69,9 @@ const arrowMessage = 'arrow_message';
67
69
err = new Error ( 'foo' ) ;
68
70
originalStack = err . stack ;
69
71
70
- internalUtil . setHiddenValue ( err , kArrowMessagePrivateSymbolIndex , arrowMessage ) ;
71
- internalUtil . decorateErrorStack ( err ) ;
72
+ binding . setHiddenValue ( err , kArrowMessagePrivateSymbolIndex , arrowMessage ) ;
73
+ decorateErrorStack ( err ) ;
72
74
73
75
assert . strictEqual ( err . stack , `${ arrowMessage } ${ originalStack } ` ) ;
74
- assert . strictEqual ( internalUtil
75
- . getHiddenValue ( err , kDecoratedPrivateSymbolIndex ) , true ) ;
76
+ assert . strictEqual (
77
+ binding . getHiddenValue ( err , kDecoratedPrivateSymbolIndex ) , true ) ;
0 commit comments