Closed xeruf closed 5 years ago
Thx for the report.
I'm assuming this is merely logging output, the application recovers and works as it should.
I'm using similar strategy elsewhere - avoid logging when catching FileNotFoundException.
I'm assuming this is merely logging output, the application recovers and works as it should.
Yes
I'm using similar strategy elsewhere - avoid logging when catching FileNotFoundException.
It shouldn't be thrown in the first place by checking whether the file exists beforehand, because creating an Exception always carries overhead.
Doing the check would involve performance impact. APIs throwing exceptions work this way - pre-operation validation is handled by doing the actual operation and then handling the appropriate case. Imagine you are converting text to number, you just want to catch NumberFormatException without prior text checking to prevent the error. In that particular case it may make sense from performance perspective, but with IO, it is the opposite.
Ugh, the useLines
... At first I thought Kotlin's shiny File extensions were great, but while useful, they do not take care of error handling and they do not even document which errors they throw!
Fixed in e7359bf
I would recommend to at least print a debug log message when the FileNotFoundException is caught, it is not good for debugging when it happens silently.
We could, but I do not see much point. We do not provide comprehensive logging about what the application is doing and doing so would be non-trivial. Is there a reason why user/dev would need to make sure whether application has not found the properties file? Simple check to see if the file exists does the job.
We do not provide comprehensive logging about what the application is doing
Then we should start, and it is best to start small. It has proven useful to me numerous times by now. Messages like this belong in debug, something that is rather spammy goes into trace. The user only sees info or even warn, so he won't care, but sometimes when debugging you might care. And it also gives you an indication of how far the app has loaded in case of crashes or smth.
Unfortunately, DEBUG logging is the least of my worries right now. Considering that I have 30h a week for this project, it would take like a week or two to get the logging up to satisfactory level. It's better to move in chunks for me for less context switching. Cutting concerns like these must be done consistently or else they add considerable overhead. Springling few logs here and there may just end up wasting time in the long run. Sorry.
I got this error repeatedly over multiple starts. Sounds like it could be solved by a simple existance check.