是否可以不使用额外的变量来找出在 catch 子句中捕获的异常,然后从 finally 子句中再次抛出它?
public void exceptionalFunction() throws Exception
{
try
{
// exception causing code
}
catch (TypeAException e)
{
// exception specific logic
}
catch (TypeBException e)
{
// exception specific logic
}
catch (TypeCException e)
{
// exception specific logic
}
finally
{
// throw the exception that was caught, if one was caught.
}
}