I'm using a windows service and I would like to catch all of the inner exceptions in my root method. In one of my inner methods, I'm using a try/catch block like below. When an error occurs, the service doesn't return the error message to my root method. Instead it just throws an error and stops inside my inner method.
How do I return the error message to my root method ?
try
{
loadAdapterProperties(ref strAssemblyName, ref strTypeName, ref statusXML,
strAssignedTask, ref lastAdapter, ref entityTypeCode, ref adminID);
if (strAssemblyName == "" || strTypeName == "")
{
LogWriter.WriteTimedMessage("No adapters currently available, {0}",
strAssignedTask);
loopCondition = false;
break;
}
objHandle = Activator.CreateInstance(strAssemblyName, strTypeName);
objAdapter = (BaseGatesAdapter)objHandle.Unwrap();
objAdapter.Load(strAssignedTask, statusXML, entityTypeCode, adminID);
objAdapter.Execute();
LogWriter.WriteTimedMessage("Executed {0}", strAssemblyName);
if (lastAdapter == true)
loopCondition = false;
}
catch (System.Exception e)
{
loopCondition = false;
LogWriter.WriteTimedMessage("FAILED to execute {0}",strAssemblyName);
throw;
}