Skip to content

Instantly share code, notes, and snippets.

@ldaniel
Created February 1, 2012 12:32
Show Gist options
  • Select an option

  • Save ldaniel/1716822 to your computer and use it in GitHub Desktop.

Select an option

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