Skip to content

Commit b32bcf7

Browse files
SirR4Tapapirovski
authored andcommitted
process: unify error message from chdir() errors
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>
1 parent 13861da commit b32bcf7

File tree

2 files changed

+15
-1
lines changed

2 files changed

+15
-1
lines changed

src/node.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1580,7 +1580,7 @@ static void Chdir(const FunctionCallbackInfo<Value>& args) {
15801580
node::Utf8Value path(args.GetIsolate(), args[0]);
15811581
int err = uv_chdir(*path);
15821582
if (err) {
1583-
return env->ThrowUVException(err, "uv_chdir");
1583+
return env->ThrowUVException(err, "chdir", nullptr, *path, nullptr);
15841584
}
15851585
}
15861586

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
'use strict';
2+
3+
const { expectsError } = require('../common');
4+
5+
expectsError(
6+
() => {
7+
process.chdir('does-not-exist');
8+
},
9+
{
10+
type: Error,
11+
code: 'ENOENT',
12+
message: "ENOENT: no such file or directory, chdir 'does-not-exist'",
13+
}
14+
);

0 commit comments

Comments
 (0)