Throw exceptions instead of being silent, just like Scala #246
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This was bothering me a bit while reviewing
because even though Scala does not require you to catch checked exceptions, it does throw them at runtime if they occur.
I don't really like being silent and just swallowing the errors and continuing like nothing happened. If people get strange behaviour because some files can't be watched or whatever it's very hard to figure out what's going on, so IMHO better to just fail with an exception. Given that the equivalent Scala code did the same, I guess this exceptions will not really occur in real life anyway.
Also, look at that better-files says about the
walk
method:So the devs were not even sure what's happening (this line was added 8+ years ago to be fair). What happens is at Runtime the
IOException
will be thrown. What they did now is:pathikrit/better-files@0a22873#diff-1eed0c8cd6c94c548b033043e1669d94cb999fd88dc17d9bc3db3f6247fb51e2L689
move that in and GitHub issue pathikrit/better-files#590 so they figure out what to do.
Anyway, I think throwing is better now. Actually nothing changes from previous play-file-watch versions...