巢狀異常嘗試捕獲塊

一個能夠在另一個內嵌一個異常/ 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 塊時避免吞嚥異常