Skip to content

Commit 8eb0d9d

Browse files
npauntargos
authored andcommitted
fs: fix wrong order of file names in cpSync error message
PR-URL: #59775 Reviewed-By: Dario Piotrowicz <[email protected]> Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: Yagiz Nizipli <[email protected]> Reviewed-By: Ulises Gascón <[email protected]> Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: James M Snell <[email protected]>
1 parent 4fd213c commit 8eb0d9d

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

‎src/node_file.cc‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3276,7 +3276,7 @@ static void CpSyncCheckPaths(const FunctionCallbackInfo<Value>& args){
32763276
std::string message =
32773277
"Cannot overwrite non-directory %s with directory %s";
32783278
returnTHROW_ERR_FS_CP_DIR_TO_NON_DIR(
3279-
env, message.c_str(), src_path_str, dest_path_str);
3279+
env, message.c_str(), dest_path_str, src_path_str);
32803280
}
32813281

32823282
if (!src_is_dir && dest_is_dir){

‎test/parallel/test-fs-cp-sync-copy-directory-to-file-error.mjs‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,11 @@ if (isInsideDirWithUnusualChars){
1414
tmpdir.refresh();
1515

1616
{
17-
constsrc=nextdir();
17+
constsrc=nextdir('FIRST_DIRECTORY');
1818
mkdirSync(src,mustNotMutateObjectDeep({recursive: true}));
1919
constdest=fixtures.path('copy/kitchen-sink/README.md');
2020
assert.throws(
2121
()=>cpSync(src,dest),
22-
{code: 'ERR_FS_CP_DIR_TO_NON_DIR'}
22+
{code: 'ERR_FS_CP_DIR_TO_NON_DIR',message: /non-directory.*README\.mdwithdirectory.*FIRST_DIRECTORY/}
2323
);
2424
}

0 commit comments

Comments
(0)