This repository has been archived by the owner on Apr 22, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 7.3k
fs.rename returns deceptive error when target path is problematic #7657
Labels
Comments
What node.js version are you referring to? |
0.10.26 |
Can you please provide a reproducible test case? |
I think this should reproduce the described problem. The error only lists the source file being renamed, even though the target is the problem. var fs = require('fs');
var assert = require('assert');
var src = 'foo.txt';
fs.writeFileSync(src, 'test');
assert(fs.existsSync(src));
assert(!fs.existsSync('bar'));
fs.rename(src, 'bar/baz.txt', function(error) {
fs.unlinkSync(src);
assert(error);
assert(error.path !== src);
}); |
That's exactly correct. It's very easy to reproduce. |
This is a dupe of #685 , right? |
@tjfontaine this should be closed as dupe of ^ |
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
when i try to rename a file and its source path is accurate, but target directory doesn't exist, I get simply ENOENT, rename and it quotes the source path. This made me think for a long time that my source path was problematic when the problem all along was that the target dir doesn't exist and there is no indication in the error of that.
The text was updated successfully, but these errors were encountered: