Hello Everybody!
Considering this code:
try
{
ExecuteOperation();
}
catch
{
Rollback();
throw;
}
Now, if ExecuteOperation() throws an exception "exA", AND during catching
also Rallback() throws an Exception "exB", I will lose every information
about exA!
The only way I found for not losing info is something like:
try
{
ExecuteOperation();
}
catch (Exception exA)
{
try
{
Rollback();
throw exA;
}
catch (Exception exB)
{
throw new ComboException(exA.Message+" and
"+exB.Message,exA,exB);
}
}
....but I would like to know if there is a better way of doing it!
Thank you!
Paolo.