summaryrefslogtreecommitdiffstats
path: root/Bugzilla/Error.pm
diff options
context:
space:
mode:
Diffstat (limited to 'Bugzilla/Error.pm')
-rw-r--r--Bugzilla/Error.pm15
1 files changed, 7 insertions, 8 deletions
diff --git a/Bugzilla/Error.pm b/Bugzilla/Error.pm
index 18f9aae54..3e5688e2a 100644
--- a/Bugzilla/Error.pm
+++ b/Bugzilla/Error.pm
@@ -46,16 +46,15 @@ sub _in_eval {
sub _throw_error {
my ($name, $error, $vars) = @_;
-
+ my $dbh = Bugzilla->dbh;
$vars ||= {};
$vars->{error} = $error;
- # Make sure any locked tables are unlocked
- # and the transaction is rolled back (if supported)
- # If we are within an eval(), do not unlock tables as we are
+ # Make sure any transaction is rolled back (if supported).
+ # If we are within an eval(), do not roll back transactions as we are
# eval'uating some test on purpose.
- Bugzilla->dbh->bz_unlock_tables(UNLOCK_ABORT) unless _in_eval();
+ $dbh->bz_rollback_transaction() if ($dbh->bz_in_transaction() && !_in_eval());
my $datadir = bz_locations()->{'datadir'};
# If a writable $datadir/errorlog exists, log error details there.
@@ -124,10 +123,10 @@ sub ThrowCodeError {
sub ThrowTemplateError {
my ($template_err) = @_;
+ my $dbh = Bugzilla->dbh;
- # Make sure any locked tables are unlocked
- # and the transaction is rolled back (if supported)
- Bugzilla->dbh->bz_unlock_tables(UNLOCK_ABORT);
+ # Make sure the transaction is rolled back (if supported).
+ $dbh->bz_rollback_transaction() if $dbh->bz_in_transaction();
my $vars = {};
if (Bugzilla->error_mode == ERROR_MODE_DIE) {