Skip to content

Commit

Permalink
process: unify error message from chdir() errors
Browse files Browse the repository at this point in the history
PR-URL: #19088
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Richard Lau <riclau@uk.ibm.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com>
  • Loading branch information
SirR4T authored and apapirovski committed Mar 6, 2018
1 parent 13861da commit b32bcf7
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/node.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1580,7 +1580,7 @@ static void Chdir(const FunctionCallbackInfo<Value>& args) {
node::Utf8Value path(args.GetIsolate(), args[0]);
int err = uv_chdir(*path);
if (err) {
return env->ThrowUVException(err, "uv_chdir");
return env->ThrowUVException(err, "chdir", nullptr, *path, nullptr);
}
}

Expand Down
14 changes: 14 additions & 0 deletions test/parallel/test-fs-chdir-errormessage.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
'use strict';

const { expectsError } = require('../common');

expectsError(
() => {
process.chdir('does-not-exist');
},
{
type: Error,
code: 'ENOENT',
message: "ENOENT: no such file or directory, chdir 'does-not-exist'",
}
);

0 comments on commit b32bcf7

Please sign in to comment.