reactphp / filesystem

Evented filesystem access.
MIT License
135 stars 40 forks source link

What should be the `getContents()` behavior when a file doesn't exist? #95

Closed mmoreram closed 2 years ago

mmoreram commented 3 years ago

Right now, when a file is not found and we access to its content, the method just keeps waiting. Instead of that, we can make an exists call before it.

Is it a good behavior to let a method keep waiting until the infinite? I understand that this action is not blocking at all, but what is the point?

SimonFrings commented 2 years ago

Hey @mmoreram, thanks for bringing this up :+1:

You're right, this should not be the behavior of getContents() when a file doesn't exist! In my opinion, this should throw an exception with a message that says that the requested file is nowhere to be found.

@WyriHaximus is currently rewriting the project, you can take a look at that here: #97. After that, we need to put some work into polishing the project so I think this will be fixed in the same run.

clue commented 2 years ago

@mmoreram Thanks for bringing this up! #97 has just been merged and I believe this has been answered, so I'm closing this for now. Please come back with more details if this problem persists and we can always reopen this :+1: