我已經做了類,這是自定義的異常類,它包含了許多重載方法關於捕獲它
public class abcException extends Exception
{}
我有我導入上述abcException類也
import com.system.error.abcException;
class fgh
{
void dhj() throws abcException //method that might throw Exception
{
try
{
}
catch(Exception bse) {
log.logError(bse.getMessage(), bse);
throw new abcException(bse.getMessage(), bse);
}
}
另一個類後拋出異常
現在我的查詢是如上面的類所示,它包含一個名爲dhj()的方法,其中 可能會拋出一個自定義異常,但爲什麼在catch塊中我們再次拋出異常後記錄 這是正確的做法嗎?請告知,請告知是否可以有這樣的事情
蟎?或者可能? –