3 ms·
Exceptions are for error reporting. Pass them through all the way to the top, and log them. Enforce module preconditions proactively. if(!isInstalled(Foo))
by pacala 8y ago
Exceptions are for error reporting. Pass them through all the way to the top, and log them. Enforce module preconditions proactively.
if(!isInstalled(Foo)) {
purchase(Foo)
} else {
start(Foo)
}
- smsm42 8y agoThis! Java is hugely overusing exceptions for reporting situations that are completely normal (probably because it didn't have anything like Option type or any way to return error results). Exception should be for "somebody stole our HD and we can't read data" or "database have died and we can't continue, all panic!", not for "user made a typo and we need to display an error message". Using exceptions for routine flow control is bad design.