Method API has to be clear about return values. It can either return value or throw an exception. But when it does both this gets really confusing. Take a look at the Java's java.io.File.createNewFile() signature:
> boolean createNewFile() throws java.io.IOException
This method returns true if "the named file does not exist and was successfully created; false if the named file already exists".
The problem with this approach is that when exception is thrown we get no return value. Has the file in fact been created or not? Not clear. And if we have to check for exception in order to find out this, the method is better be void. Ideally, with unchecked exception.
> void createNewFile();
Just like that. And we do want to check, we check for exception.
try {
createNewFile();
} catch (IOException e) {
// file not created. 100%. Guaranteed. No need to look at something else.
}