Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

moveSync error does not have code property #734

Closed
bmuenzenmeyer opened this issue Nov 21, 2019 · 3 comments
Closed

moveSync error does not have code property #734

bmuenzenmeyer opened this issue Nov 21, 2019 · 3 comments

Comments

@bmuenzenmeyer
Copy link

  • Operating System: Windows, and online REPLs
  • Node.js version: 12.13.0
  • fs-extra version: 8.1.0

First reported within facebook/create-react-app#7892 - moveSync errors thrown when the destination already exist do not have EEXISTS as a code property, causing defensive try catches (in that thread) to fall through

I isolated this behavior outside of CRA, and I think it serves as a proper reduced test case to discuss further.

✔️ fs-extra@7.0.1 moveSync behavior with error.code
fs-extra@8.1.0 moveSync behavior without error.code

@RyanZim
Copy link
Collaborator

RyanZim commented Nov 21, 2019

Yeah, for a time we tried to fake native Node errors, but gave up on it since they're impossible to completely properly replicate.

@bmuenzenmeyer
Copy link
Author

bmuenzenmeyer commented Nov 21, 2019

so in your opinion, downstream code should be matching against dest already exists ?

This also seems like a breaking change. I will check again, as I I may have missed it in your changelog.

EDIT: I've also suggested in CRA to refactor the code with an existsSync check prior to a move, if needed

@RyanZim
Copy link
Collaborator

RyanZim commented Nov 21, 2019

Yeah, should have been clearer in the release notes; 8.0.0 did a lot of changes to move and moveSync, many of which were breaking

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants