.Net异常偷看.(更新)

eya*_*yan 1 .net exception

尝试
{
throw new Exception("test");
}
finally
{
//检查异常????
//日志(例外);
}

有没有办法从最终的运行时中获取异常?
我不能用捕获物:-)

谢谢你的回答.
我不能使用catch,因为它实际上不是我的代码(重构).
我们想要包装一段代码:

using(CriticalFlow(policy))  
{  
   //Not my code.  
   flow.Succeeded();  
}  
Run Code Online (Sandbox Code Playgroud)

在CriticalFlow finally块中,我们需要检查异常,如果没有调用成功,则以任何方式提醒任何人.
我希望它能为原来的问题提供一些启示.

再次感谢.

小智 7

Exception helper;

try
{

}
catch (Exception ex)
{
    helper = ex;
}
finally
{
   if (helper != null)
   {
      process helper
   }
}
Run Code Online (Sandbox Code Playgroud)