Does anyone know if there is a way to generate different code in the catch block automatically depending on the exception?
The Eclipse function 'Surround with try/catch' generates a try/catch block which just includes dumping a stack trace.
I'm doing a bunch of similar things in the code and so most of my exceptions will boil down to probably three or so different types. I'd like to have different catch block code for each one and have eclipse auto format based on the exception.
For example: if my code generates a RemoteConnectionException I'd like to display a dialog to the user to reconnect. If it generates a RemoteContentException I'd like to log it.
(I made these up.)
Thanks in advance
UPDATE: I've been poking around and have two potential solutions.
1) I've found something called the fast code plugin which might do what I'm looking for. http://fast-code.sourceforge.net/index.htm
2) For specifically handling exceptions I'll probably just write a generic exception handler and modify the catch block code to pass the exception to that instead of printing the stack trace. Then the java code will determine which action to take based on exception type.