オプションA:
public void method() {
try {
// some operation that throws FirstException
} catch (FirstException ex) {
throw new RuntimeException(ex);
}
try {
// some operation that throws SecondException
} catch (SecondException ex) {
throw new RuntimeException(ex);
}
}
オプションB:
public void method() {
try {
// some operation that throws FirstException
// some operation that throws SecondException
} catch (FirstException ex) {
throw new RuntimeException(ex);
} catch (SecondException ex) {
throw new RuntimeException(ex);
}
}
どちらが優れているのか、そしてその理由は?