Lets say you had some resource clean up like: This is C#.
try{/*stuff*/}
catch(Exception e) {/*rollback logs etc.*/}
finally{
if( context.Transaction != null )
context.Transaction.Dispose();
context.Connection.Close();
context.Connection.Dispose();
}
Would it be more robust to do this instead?
try{/*stuff*/}
catch(Exception e) {/*rollback logs etc.*/}
finally{
try{
if( context.Transaction != null )
context.Transaction.Dispose();
}catch(Exception e){/*logs*/}
finally{
context.Connection.Close();
context.Connection.Dispose();
}
}
This way if the transaction.dispose manages to fail at leat the connection will be given the chance to close.