mirror of
https://github.com/1C-Company/v8-code-style.git
synced 2025-01-20 21:18:18 +02:00
895 B
895 B
The scheme of working with transactions is broken
Rollback transaction must be in a try-catch, there should be no executable code between exception and rollback transaction, there is no begin transaction for rollback transaction, there is no commit transaction for begin transaction.
Noncompliant Code Example
BeginTransaction();
Try
// ...
CommitTransaction();
Except
// ...
Raise;
EndTry;
RollbackTransaction();
Compliant Solution
BeginTransaction();
Try
// ...
CommitTransaction();
Except
// ...
RollbackTransaction();
// ...
Raise;
EndTry;