Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions lib/fs.js
Original file line number Diff line number Diff line change
Expand Up @@ -1161,6 +1161,11 @@ fs.readlinkSync = function(path, options) {
options.encoding, undefined, ctx);
if (ctx.errno !== undefined) {
throw errors.uvException(ctx);
} else if (ctx.error) {
// TODO(joyeecheung): this is an encoding error usually caused by memory
// problems. We need to figure out proper error code(s) for this.
Error.captureStackTrace(ctx.error);
throw ctx.error;
}
return result;
};
Expand Down Expand Up @@ -1232,11 +1237,6 @@ fs.symlinkSync = function(target, path, type) {

if (ctx.errno !== undefined) {
throw errors.uvException(ctx);
} else if (ctx.error) {
// TODO(joyeecheung): this is an encoding error usually caused by memory
// problems. We need to figure out proper error code(s) for this.
Error.captureStackTrace(ctx.error);
throw ctx.error;
}
};

Expand Down
2 changes: 1 addition & 1 deletion src/node_file.cc
Original file line number Diff line number Diff line change
Expand Up @@ -886,7 +886,7 @@ static void ReadLink(const FunctionCallbackInfo<Value>& args) {
fs_req_wrap req;
int err = SyncCall(env, args[3], &req, "readlink",
uv_fs_readlink, *path);
if (err) {
if (err < 0) {
return; // syscall failed, no need to continue, error info is in ctx
}
const char* link_path = static_cast<const char*>(req.req.ptr);
Expand Down