void function() {
try
{
// do something
foreach (item in itemList)
{
try
{
//do something
}
catch (Exception ex)
{
throw new Exception("functionB: " + ex.Message);
}
}
}
catch (Exception ex)
{
LogTransaction(ex.Message);
}
}
嗨,我想将 for 循环中的异常抛出给它的父级。目前当for循环出现异常时,循环会被终止。无论如何要修改它以便抛出异常但循环将继续?