Closed
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
Lines 225 to 226 in c8a0404
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?