PixelPaul
PixelPaul

Reputation: 2777

Exception being thrown but not caught

I am using the Telerik OpenAccess ORM. There are instances where an exception occurs when there are concurrent updates happening on the same database record. I am trying to catch an exception error that is being thrown:

try
{
    this._dbContext.SaveChanges();
}
catch (Telerik.OpenAccess.Exceptions.OptimisticVerificationException ex)
{
    Debug.WriteLine($"EXCEPTION ERROR CAUGHT: {ex}");
}

When I debug, I can see that the exception is being logged in the Visual Studio output window:

Telerik.OpenAccess Error: 5 : Row not found: GenericOID@fd1c5f2e ORDERS ORDER_ID=12345678
UPDATE "ORDERS" SET "DEPOSIT_AMOUNT" = ? WHERE "ORDER_ID" = ? AND "DEPOSIT_AMOUNT" = ?
(set event logging to all to see parameter values)
Exception thrown: 'Telerik.OpenAccess.Exceptions.OptimisticVerificationException' in Telerik.OpenAccess.dll

But the code doesn't fall into the catch block. Any ideas why?

Upvotes: 0

Views: 127

Answers (0)

Related Questions