Does anyone know if there is a way to generate different code in a catch block automatically depending on the exception?
The Eclipse "Surround with try / catch" function generates a try / catch block that only includes resetting the stack trace.
I do a bunch of similar things in code, and so most of my exceptions will thicken to three or more different types. I would like to have a different catch lock code for each of them and have an automatic exception-based eclipse format.
For example: if my code throws a RemoteConnectionException, I would like to display a dialog box for reconnecting the user. If it throws a RemoteContentException, I would like to register it.
(I did it.)
Thanks in advance
UPDATE: I have already said and have two potential solutions.
1) I found something called a quick code plugin that can do what I'm looking for.
http://fast-code.sourceforge.net/index.htm
2) In order to specifically handle exceptions, I will probably just write a general exception handler and modify the catch block code to pass an exception instead, and not print a stack trace. Then the java code will determine what action to take based on the type of exception.
source
share