-
-
Notifications
You must be signed in to change notification settings - Fork 33.2k
Closed
Labels
fsIssues and PRs related to the fs subsystem / file system.Issues and PRs related to the fs subsystem / file system.
Description
Version
17.2.0
Platform
No response
Subsystem
No response
What steps will reproduce the bug?
$ touch example
$ node -e "require('fs').cp('example', 'example', console.log)"
This throws as expected ERR_FS_CP_EINVAL.
How often does it reproduce? Is there a required condition?
Always
What is the expected behavior?
SystemError [ERR_FS_CP_EINVAL]: Invalid src or dest: cp returned EINVAL (src and dest cannot be the same) example
^^^^^^
What do you see instead?
SystemError [ERR_FS_CP_EINVAL]: Invalid src or dest: cp returned undefined (src and dest cannot be the same) example
^^^^^^^^^
Additional information
I'm not sure if this is a bug or intentional behavior but seeing undefined
in an error message was unexpected.
Lines 80 to 85 in 87d6fd7
throw new ERR_FS_CP_EINVAL({ | |
message: 'src and dest cannot be the same', | |
path: dest, | |
syscall: 'cp', | |
errno: EINVAL, | |
}); |
Lines 225 to 226 in c8a0404
let message = `${prefix}: ${context.syscall} returned ` + | |
`${context.code} (${context.message})`; |
Based on the code should new ERR_FS_CP_EINVAL pass code: EINVAL
, or should SystemError use context.code ?? context.errno
, or is this the intended behavior?
Metadata
Metadata
Assignees
Labels
fsIssues and PRs related to the fs subsystem / file system.Issues and PRs related to the fs subsystem / file system.