File tree Expand file tree Collapse file tree 1 file changed +17
-6
lines changed
Expand file tree Collapse file tree 1 file changed +17
-6
lines changed Original file line number Diff line number Diff line change @@ -38,12 +38,23 @@ private void FinishTransaction(string finalizer)
3838 throw new InvalidOperationException ( "Transaction has already been finished." ) ;
3939 }
4040
41- connection . ExecuteNonQuery ( finalizer ) ;
42- connection . Transaction = null ;
43- finished = true ;
41+ try
42+ {
43+ connection . ExecuteNonQuery ( finalizer ) ;
44+ connection . Transaction = null ;
45+ finished = true ;
46+ }
47+ // If something goes wrong with the transaction, to match the
48+ // transaction's internal duckdb state it should still be considered
49+ // finished and should no longer be used
50+ catch ( DuckDBException ex ) when ( ex . ErrorType == Native . DuckDBErrorType . Transaction )
51+ {
52+ connection . Transaction = null ;
53+ finished = true ;
54+ throw ;
55+ }
4456 }
45-
46-
57+
4758 protected override void Dispose ( bool disposing )
4859 {
4960 base . Dispose ( disposing ) ;
@@ -53,4 +64,4 @@ protected override void Dispose(bool disposing)
5364 Rollback ( ) ;
5465 }
5566 }
56- }
67+ }
You can’t perform that action at this time.
0 commit comments