playframework / play-file-watch

This is the Play File Watch library
Apache License 2.0
14 stars 18 forks source link

Throw exceptions instead of being silent, just like Scala #246

Closed mkurz closed 11 months ago

mkurz commented 11 months ago

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: https://github.com/pathikrit/better-files/commit/0a22873bd4ae837ee6de892dc3fee4559f7e439a#diff-1eed0c8cd6c94c548b033043e1669d94cb999fd88dc17d9bc3db3f6247fb51e2L689 move that in and GitHub issue https://github.com/pathikrit/better-files/issues/590 so they figure out what to do. Anyway, I think throwing is better now. Actually nothing changes from previous play-file-watch versions...