mirror of
https://github.com/zebrajr/node.git
synced 2026-01-15 12:15:26 +00:00
fs: fix cp dir/non-dir mismatch error messages
The error messages for `ERR_FS_CP_DIR_TO_NON_DIR` and `ERR_FS_CP_NON_DIR_TO_DIR` were the inverse of the copy direction actually performed. Refs: https://github.com/nodejs/node/issues/44598#issuecomment-1562522423 PR-URL: https://github.com/nodejs/node/pull/53150 Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: LiviaMedeiros <livia@cirno.name> Reviewed-By: Feng Yu <F3n67u@outlook.com>
This commit is contained in:
@@ -1204,12 +1204,12 @@ E('ERR_FEATURE_UNAVAILABLE_ON_PLATFORM',
|
||||
', which is being used to run Node.js',
|
||||
TypeError);
|
||||
E('ERR_FS_CP_DIR_TO_NON_DIR',
|
||||
'Cannot overwrite directory with non-directory', SystemError);
|
||||
'Cannot overwrite non-directory with directory', SystemError);
|
||||
E('ERR_FS_CP_EEXIST', 'Target already exists', SystemError);
|
||||
E('ERR_FS_CP_EINVAL', 'Invalid src or dest', SystemError);
|
||||
E('ERR_FS_CP_FIFO_PIPE', 'Cannot copy a FIFO pipe', SystemError);
|
||||
E('ERR_FS_CP_NON_DIR_TO_DIR',
|
||||
'Cannot overwrite non-directory with directory', SystemError);
|
||||
'Cannot overwrite directory with non-directory', SystemError);
|
||||
E('ERR_FS_CP_SOCKET', 'Cannot copy a socket file', SystemError);
|
||||
E('ERR_FS_CP_SYMLINK_TO_SUBDIRECTORY',
|
||||
'Cannot overwrite symlink in subdirectory of self', SystemError);
|
||||
|
||||
@@ -82,8 +82,8 @@ function checkPathsSync(src, dest, opts) {
|
||||
}
|
||||
if (srcStat.isDirectory() && !destStat.isDirectory()) {
|
||||
throw new ERR_FS_CP_DIR_TO_NON_DIR({
|
||||
message: `cannot overwrite directory ${src} ` +
|
||||
`with non-directory ${dest}`,
|
||||
message: `cannot overwrite non-directory ${dest} ` +
|
||||
`with directory ${src}`,
|
||||
path: dest,
|
||||
syscall: 'cp',
|
||||
errno: EISDIR,
|
||||
@@ -92,8 +92,8 @@ function checkPathsSync(src, dest, opts) {
|
||||
}
|
||||
if (!srcStat.isDirectory() && destStat.isDirectory()) {
|
||||
throw new ERR_FS_CP_NON_DIR_TO_DIR({
|
||||
message: `cannot overwrite non-directory ${src} ` +
|
||||
`with directory ${dest}`,
|
||||
message: `cannot overwrite directory ${dest} ` +
|
||||
`with non-directory ${src}`,
|
||||
path: dest,
|
||||
syscall: 'cp',
|
||||
errno: ENOTDIR,
|
||||
|
||||
@@ -86,8 +86,8 @@ async function checkPaths(src, dest, opts) {
|
||||
}
|
||||
if (srcStat.isDirectory() && !destStat.isDirectory()) {
|
||||
throw new ERR_FS_CP_DIR_TO_NON_DIR({
|
||||
message: `cannot overwrite directory ${src} ` +
|
||||
`with non-directory ${dest}`,
|
||||
message: `cannot overwrite non-directory ${dest} ` +
|
||||
`with directory ${src}`,
|
||||
path: dest,
|
||||
syscall: 'cp',
|
||||
errno: EISDIR,
|
||||
@@ -96,8 +96,8 @@ async function checkPaths(src, dest, opts) {
|
||||
}
|
||||
if (!srcStat.isDirectory() && destStat.isDirectory()) {
|
||||
throw new ERR_FS_CP_NON_DIR_TO_DIR({
|
||||
message: `cannot overwrite non-directory ${src} ` +
|
||||
`with directory ${dest}`,
|
||||
message: `cannot overwrite directory ${dest} ` +
|
||||
`with non-directory ${src}`,
|
||||
path: dest,
|
||||
syscall: 'cp',
|
||||
errno: ENOTDIR,
|
||||
|
||||
Reference in New Issue
Block a user