(context: integrating with an application -Jenkins- with various plugins not all with good design)
I have these exception:
public class AbortException extends IOException
and in some cases I want to catch IOException but avoid catching the AbortException
Which one is more correct?
try {
...
} catch (AbortException e) {
throw e //this failure should fail
} catch (IOException e) {
[handle this]
}
or
try {
...
} catch (IOException e) {
if (e instanceof AbortException)
throw e //this failure should fail
else
[handle this]
}
I am unsure if in the first case the second catch block would intercept the re-thrown AbortException