Here is my situation, I have a peace of code like this:
Code: Select all
DB.Connection.Open();
using (DbTransaction transaction = DB.Connection.BeginTransaction()) {
try {
... some code here
transaction.Commit();
} catch (Exception ex) {
transaction.Rollback();
throw ex;
} finally {
base.DisposeDB();
}
}
so far so good, I get the timeout error as I expected. (I set a timeout in conn string to 30 seconds)
but when the execution reached transaction.Rollback() line that causes another exception because connection is dropped by now. {"Network error: 200"}
so, the line throw ex is never reached
then base.disposeDB fails as well since connection is closed, and I get {"Connection must be opened."} exception.
point is, by the time exception reach my error page I loose the original exception and all I can see is the last one.
how do I get around this issue?
thanks