0

我被告知要传播所有异常。这句话表示主动传播,例如:

公共 void 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�);

}

或被动传播:

public void doSomething() 抛出 SomeException {

try{

    doSomethingThatCanThrowException();

} finally {
   //clean up � close open resources etc.
}

}

.传播所有异常是什么意思?

干杯

4

0 回答 0