@@ -60,28 +60,48 @@ const {
60
60
setPriority : _setPriority ,
61
61
} = internalBinding ( 'os' ) ;
62
62
63
- function getCheckedFunction ( fn ) {
64
- return hideStackFrames ( function checkError ( ...args ) {
65
- const ctx = { } ;
66
- const ret = fn ( ...args , ctx ) ;
67
- if ( ret === undefined ) {
68
- throw new ERR_SYSTEM_ERROR ( ctx ) ;
69
- }
70
- return ret ;
71
- } ) ;
72
- }
73
-
74
63
const {
75
64
0 : type ,
76
65
1 : version ,
77
66
2 : release ,
78
67
3 : machine ,
79
68
} = _getOSInformation ( ) ;
80
69
81
- const getHomeDirectory = getCheckedFunction ( _getHomeDirectory ) ;
82
- const getHostname = getCheckedFunction ( _getHostname ) ;
83
- const getInterfaceAddresses = getCheckedFunction ( _getInterfaceAddresses ) ;
84
- const getUptime = getCheckedFunction ( _getUptime ) ;
70
+ const getHomeDirectory = hideStackFrames ( ( ) => {
71
+ const ctx = { } ;
72
+ const ret = _getHomeDirectory ( ctx ) ;
73
+ if ( ret === undefined ) {
74
+ throw new ERR_SYSTEM_ERROR ( ctx ) ;
75
+ }
76
+ return ret ;
77
+ } ) ;
78
+
79
+ const getHostname = hideStackFrames ( ( ) => {
80
+ const ctx = { } ;
81
+ const ret = _getHostname ( ctx ) ;
82
+ if ( ret === undefined ) {
83
+ throw new ERR_SYSTEM_ERROR ( ctx ) ;
84
+ }
85
+ return ret ;
86
+ } ) ;
87
+
88
+ const getInterfaceAddresses = hideStackFrames ( ( ) => {
89
+ const ctx = { } ;
90
+ const ret = _getInterfaceAddresses ( ctx ) ;
91
+ if ( ret === undefined ) {
92
+ throw new ERR_SYSTEM_ERROR ( ctx ) ;
93
+ }
94
+ return ret ;
95
+ } ) ;
96
+
97
+ const getUptime = hideStackFrames ( ( ) => {
98
+ const ctx = { } ;
99
+ const ret = _getUptime ( ctx ) ;
100
+ if ( ret === undefined ) {
101
+ throw new ERR_SYSTEM_ERROR ( ctx ) ;
102
+ }
103
+ return ret ;
104
+ } ) ;
85
105
86
106
/**
87
107
* @returns {string }
0 commit comments