Last active
September 18, 2015 05:52
-
-
Save up1/993f5a49ffa697b656d2 to your computer and use it in GitHub Desktop.
Demo :: clean code -> handling exception
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) { | |
.... | |
} | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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