Rethrow Exception : throw « Statement « Visual C++ .NET






Rethrow Exception

 

#include "stdafx.h"
using namespace System;

void main(){
    try{
        try{
            throw gcnew ApplicationException("\t***Boom***");
            Console::WriteLine("Imbedded Try End");
        }catch (ApplicationException ^ie){
            Console::WriteLine("Caught Exception ");
            Console::WriteLine(ie->Message);
            throw;
        }
        Console::WriteLine("Outer Try End");
    }
    catch (ApplicationException ^oe)
    {
        Console::WriteLine("Recaught Exception ");
        Console::WriteLine(oe->Message);
    }
} 

   
  








Related examples in the same category

1.Throw Derived Exception
2.Throw string as exception
3.Throw gcnew exception