process: unify error message from chdir() errors

PR-URL: https://github.com/nodejs/node/pull/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>
This commit is contained in:
Sarat Addepalli 2018-03-02 21:01:51 +05:30 committed by Anatoli Papirovski
parent 13861da9c0
commit b32bcf7e9c
No known key found for this signature in database
GPG Key ID: 614E2E1ABEB4B2C0
2 changed files with 15 additions and 1 deletions

View File

@ -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);
}
}

View File

@ -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'",
}
);