Skip to main content
8 events
when toggle format what by license comment
Jun 16, 2020 at 10:01 history edited CommunityBot
Commonmark migration
Feb 22, 2015 at 16:22 comment added Robert Harvey @Hawknight: The Java community hates exceptions because the Java language makes them so damned difficult to use. The best practice for Java is Checked Exceptions, but nobody uses them because the amount of bondage and discipline required exceeds the benefit they provide.
Feb 22, 2015 at 10:43 comment added Jonathan Taws @RobertHarvey I think I've understood exceptions, but really, what is bothering me, is how much the Java community hates exceptions. I'd like to have a program that can follow the main guidelines in the Java community. I'm completely agree with you, but when you say rethrow, that means that it will be the work of a layer higher in the hiearchy to handle, right ? I shouldn't leave any exception go out of the scope on my application, apart from serious runtime exceptions ?
Feb 22, 2015 at 1:30 comment added Robert Harvey @user61852: You can write code that verifies that a file exists without having to catch an exception.
Feb 22, 2015 at 1:25 comment added Tulains Córdova @KonradMorawski If the code that verifies that the file exist says the file exists, but in reality it doesn't, a FileNotFoundException must be catched anyway. Validations and exception catching are not mutually exclusive.
Feb 22, 2015 at 0:55 comment added Robert Harvey @KonradMorawski: This is why there's no such thing as an ironclad rule. What you're describing is UI validation, and is a perfectly reasonable way to approach it in a UI. What I am describing is an API or service, some function where you may not know ahead of time that the file does not exist.
Feb 22, 2015 at 0:42 comment added Konrad Morawski if [...] user supplies a path to a file that does not exist, then you should throw an exception - but why? I'd just check whether the file exists and show an error message if it doesn't. While you can trigger this by throwing an exception, what's the reason you should?
Feb 22, 2015 at 0:33 history answered Robert Harvey CC BY-SA 3.0