- #1
SlurrerOfSpeech
- 141
- 11
"Gotta catch 'em all"
e.g.
I believe there are justifications for doing this:
e.g.
Code:
try {
// something that might fail for reasons I don't want to anticipate
}
catch (Exception ex) {
// do something
}
I believe there are justifications for doing this:
- Inside the try block I'm using a class from a 3rd party library that doesn't have any documentation. I'm not sure exactly what exceptions might be thrown and for what reason.
- I'm aware of at least 5 types of exceptions that could be thrown and I would handle them each the same way. It seems rather stupid to write
Code:
catch (ExceptionType1 ex) {
// do something
}
catch (ExceptionType2 ex) {
// do same thing as before
}