I have below Child method which deal with DB calls. so this can produce normal exception or SQLexception also. so this code block have 2 catch blocks.
public void ChildMethod()
{
try
{
//dbcall code
}
catch(Exception exc)
{
throw exc;
}
catch(sqlException sqlex)
{
throw sqlex;
}
}
I have this Parent method which calls the Chile method. it have its own try catch block. But how to pass the base exception, e.g. suppose there is a exception from child class, i want to pass the same exception to the parent methods catch block, thus i can push the exception details to some other source.
Parent code
public void ParentMethod()
{
try{
chileMethod();
}
catch(exception ex)
{
ApplicaitonInsightlogging.Add(ex); // This ex should contain the Base exception.
}