Skip to content

Instantly share code, notes, and snippets.

@up1
Last active September 18, 2015 05:52
Show Gist options
  • Save up1/993f5a49ffa697b656d2 to your computer and use it in GitHub Desktop.
Save up1/993f5a49ffa697b656d2 to your computer and use it in GitHub Desktop.
Demo :: clean code -> handling exception
String status = "";
status = connect();
if(status != null && "success".equals(status)) {
status = prepare();
if(status != null && "success".equals(status)) {
List<User> users = execute();
if(users != null && users.size() > 0) {
....
}
}
}
try {
connect();
prepare();
List<User> users = execute();
...
} catch( Exception e) {
//handle when exceptions are occured
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment