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