我被告知传播所有异常。这句话意味着主动传播,例如:
公共无效doSomething()引发SomeException {
try{
doSomethingThatCanThrowException();
} catch (SomeException e){
e.addContextInformation(�more info�);
throw e; //throw e, or wrap it � see next line.
//throw new WrappingException(e, �more information�);
}
或被动传播:
公共无效doSomething()引发SomeException {
try{
doSomethingThatCanThrowException();
} finally {
//clean up � close open resources etc.
}
}
。传播所有异常意味着什么?
欢呼声