diff options
author | mkanat%kerio.com <> | 2005-03-05 08:18:47 +0000 |
---|---|---|
committer | mkanat%kerio.com <> | 2005-03-05 08:18:47 +0000 |
commit | ec610fd673feb6d6e18d121b5e67aa3f87e7f4ea (patch) | |
tree | b1d6fe9b10b89a30e2b1932d050d5678362f638a /Bugzilla/Error.pm | |
parent | Bug 283394: Editing or deleting classifications causes a blank page (diff) | |
download | bugzilla-ec610fd673feb6d6e18d121b5e67aa3f87e7f4ea.tar.gz bugzilla-ec610fd673feb6d6e18d121b5e67aa3f87e7f4ea.tar.bz2 bugzilla-ec610fd673feb6d6e18d121b5e67aa3f87e7f4ea.zip |
Bug 277782: _throw_error should unlock tables when tables are locked, automatically
Patch By Tomas Kopal <Tomas.Kopal@altap.cz> r=travis, r=LpSolit, a=justdave
Diffstat (limited to 'Bugzilla/Error.pm')
-rw-r--r-- | Bugzilla/Error.pm | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/Bugzilla/Error.pm b/Bugzilla/Error.pm index 4c6288a28..6eac5c94b 100644 --- a/Bugzilla/Error.pm +++ b/Bugzilla/Error.pm @@ -32,13 +32,15 @@ use Bugzilla::Util; use Date::Format; sub _throw_error { - my ($name, $error, $vars, $unlock_tables) = @_; + my ($name, $error, $vars) = @_; $vars ||= {}; $vars->{error} = $error; - Bugzilla->dbh->bz_unlock_tables(UNLOCK_ABORT) if $unlock_tables; + # Make sure any locked tables are unlocked + # and the transaction is rolled back (if supported) + Bugzilla->dbh->bz_unlock_tables(UNLOCK_ABORT); # If a writable data/errorlog exists, log error details there. if (-w "data/errorlog") { @@ -95,6 +97,10 @@ sub ThrowCodeError { sub ThrowTemplateError { my ($template_err) = @_; + # Make sure any locked tables are unlocked + # and the transaction is rolled back (if supported) + Bugzilla->dbh->bz_unlock_tables(UNLOCK_ABORT); + my $vars = {}; if (Bugzilla->batch) { die("error: template error: $template_err"); @@ -149,16 +155,16 @@ Bugzilla::Error - Error handling utilities for Bugzilla ThrowUserError("error_tag", { foo => 'bar' }); - # supplying "abort" to ensure tables are unlocked - ThrowUserError("another_error_tag", - { foo => 'bar' }, 'abort'); - =head1 DESCRIPTION Various places throughout the Bugzilla codebase need to report errors to the user. The C<Throw*Error> family of functions allow this to be done in a generic and localisable manner. +These functions automatically unlock the database tables, if there were any +locked. They will also roll back the transaction, if it is supported by +the underlying DB. + =head1 FUNCTIONS =over 4 @@ -170,12 +176,6 @@ of variables as a second argument. These are used by the I<global/user-error.html.tmpl> template to format the error, using the passed in variables as required. -An optional third argument may be supplied. If present, the error -handling code will unlock the database tables: it is a Bugzilla standard -to provide the string "abort" as the argument value. In the long term, -this argument will go away, to be replaced by transactional C<rollback> -calls. There is no timeframe for doing so, however. - =item C<ThrowCodeError> This function is used when an internal check detects an error of some sort. |