summaryrefslogtreecommitdiff
path: root/lib/os.js
diff options
context:
space:
mode:
Diffstat (limited to 'lib/os.js')
-rw-r--r--lib/os.js15
1 files changed, 9 insertions, 6 deletions
diff --git a/lib/os.js b/lib/os.js
index d6ecd29f57..af97f40e57 100644
--- a/lib/os.js
+++ b/lib/os.js
@@ -26,7 +26,12 @@ const constants = internalBinding('constants').os;
const { deprecate } = require('internal/util');
const isWindows = process.platform === 'win32';
-const { codes: { ERR_SYSTEM_ERROR } } = require('internal/errors');
+const {
+ codes: {
+ ERR_SYSTEM_ERROR
+ },
+ hideStackFrames
+} = require('internal/errors');
const { validateInt32 } = require('internal/validators');
const {
@@ -47,16 +52,14 @@ const {
} = internalBinding('os');
function getCheckedFunction(fn) {
- return function checkError(...args) {
+ return hideStackFrames(function checkError(...args) {
const ctx = {};
const ret = fn(...args, ctx);
if (ret === undefined) {
- const err = new ERR_SYSTEM_ERROR(ctx);
- Error.captureStackTrace(err, checkError);
- throw err;
+ throw new ERR_SYSTEM_ERROR(ctx);
}
return ret;
- };
+ });
}
const getHomeDirectory = getCheckedFunction(_getHomeDirectory);