2 ms·
The problem is what would happen in reality is that programmer B would do catch(Exception e) { log(e); continue; } somewhere, because otherwise it doesn't work
by smsm42 8y ago
The problem is what would happen in reality is that programmer B would do catch(Exception e) { log(e); continue; } somewhere, because otherwise it doesn't work or requires to change signatures to 20 methods, and all good intentions will die with it. Yes, I've seen libraries (and not just something a random kid put on github, ones which are very mainstream and recommended for their use case) with APIs just plain declaring "throws Exception" because who cares, right? We warned you we might throw exceptions, deal with it! But why go to libraries - in Java's own stdlib AutoCloseable.close() is declared "throws Exception"! Tell me again about nice exception hierarchy and versioning and stuff.
And of course writing "throws Exception" on every single test is hugely annoying. Yes, I do not want to handle exceptions in the tests, that's the whole point of the test!