0

If an exception is happened in a Subfunction, I would like to have this exception also in the parent method. For example:

In my main Class I have such functions:

public static void ParentFunction(TraceWriter log)
{
   logger = log;               
   subFunction1(logger);     
}


static int subFunction1(TraceWriter log)
{
   try
   {
     SubFunction2(int param1,int param2)
     //Some Code here
   }
   catch( exception e)
   {
    //Some Code here
   }
}

In another c# class I have the definition for SubFunction2:

 public static void SubFunction2(int param1, int param2)
 {
   //Constructor
    SubFunction2();
 }
//if some exception in this function is happened, I would like to have also an exception in ParentFunction
private static void subFunction2()
{
   try
   {
     //Some Code here
   }
   catch( exception e)
   {
    //some code
   }
}

if some exception in subFunction2() is happened, I would like to have also an exception in ParentFunction. Ho should I change my code to achieve this aim?

Kaja
  • 2,962
  • 18
  • 63
  • 99

0 Answers0