summaryrefslogtreecommitdiff
path: root/lib/fs.js
diff options
context:
space:
mode:
Diffstat (limited to 'lib/fs.js')
-rw-r--r--lib/fs.js20
1 files changed, 2 insertions, 18 deletions
diff --git a/lib/fs.js b/lib/fs.js
index 38c13613cb..9effb93acb 100644
--- a/lib/fs.js
+++ b/lib/fs.js
@@ -74,7 +74,8 @@ const {
validateOffsetLengthRead,
validateOffsetLengthWrite,
validatePath,
- warnOnNonPortableTemplate
+ warnOnNonPortableTemplate,
+ handleErrorFromBinding
} = require('internal/fs/utils');
const {
CHAR_FORWARD_SLASH,
@@ -117,23 +118,6 @@ function showTruncateDeprecation() {
}
}
-function handleErrorFromBinding(ctx) {
- if (ctx.errno !== undefined) { // libuv error numbers
- const err = uvException(ctx);
- // eslint-disable-next-line no-restricted-syntax
- Error.captureStackTrace(err, handleErrorFromBinding);
- throw err;
- }
- if (ctx.error !== undefined) { // Errors created in C++ land.
- // TODO(joyeecheung): currently, ctx.error are encoding errors
- // usually caused by memory problems. We need to figure out proper error
- // code(s) for this.
- // eslint-disable-next-line no-restricted-syntax
- Error.captureStackTrace(ctx.error, handleErrorFromBinding);
- throw ctx.error;
- }
-}
-
function maybeCallback(cb) {
if (typeof cb === 'function')
return cb;