Control Flow - Java
public Success download(
final String path
)
throws
UnknownHostException,
ConnectionLostException,
OutOfDiskSpaceException
{
//
}
public enum Success {
DOWNLOADED,
CACHED;
}
Usage
// Use `download()`
try {
download("a_file.txt");
download("b_file.txt");
upload("a_file.txt");
}
catch (OutOfDiskSpaceException e) {}
catch (UnknownHostException e) {}
catch (ConnectionLostException e) {}
Unambiguous
try {
download("a_file.txt");
}
catch (UnknownHostException e) {}
catch (ConnectionLostException e) {}
catch (OutOfDiskSpaceException e) {}
try {
download("b_file.txt");
}
catch (UnknownHostException e) {}
catch (ConnectionLostException e) {}
catch (OutOfDiskSpaceException e) {}
try {
upload("a_file.txt");
}
catch (UnknownHostException e) {}
catch (ConnectionLostException e) {}