Skip to content

Instantly share code, notes, and snippets.

@ldaniel
Created February 1, 2012 12:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ldaniel/1716822 to your computer and use it in GitHub Desktop.
Save ldaniel/1716822 to your computer and use it in GitHub Desktop.
Multiple catch blocks
try {
// codigo que pode gerar IOException
}
catch (FileNotFoundException e){
// tratamento
}
catch (IOException e){
// tratamento
}
///////////////// cuidado: code bad smell
try {
}
catch (SqlException e){
// tratamento
}
catch (DivisionByZeroException e){
// tratamento
}
catch (FileNotFoundException e){
// tratamento
}
catch (IOException e){
// tratamento
}
catch (Exception e){
// tratamento
}
///////////////// cuidado: code bad smell
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment