嵌套异常尝试捕获块

一个能够在另一个内嵌一个异常/ try catch 块。

这样就可以管理小块代码,这些代码能够在不中断整个机制的情况下工作。

try 
{
//some code here
    try 
    {
        //some thing which throws an exception. For Eg : divide by 0
    }
    catch (DivideByZeroException dzEx)
    {
        //handle here only this exception
        //throw from here will be passed on to the parent catch block
    }
    finally
    {
        //any thing to do after it is done.
    }
 //resume from here & proceed as normal; 
}
catch(Exception e)
{
    //handle here
}

注意: 投掷到父 catch 块时避免吞咽异常