summaryrefslogtreecommitdiffstats
path: root/Bugzilla
diff options
context:
space:
mode:
Diffstat (limited to 'Bugzilla')
-rw-r--r--Bugzilla/Auth/Login/WWW/CGI.pm2
-rwxr-xr-xBugzilla/Bug.pm9
-rw-r--r--Bugzilla/Error.pm24
3 files changed, 16 insertions, 19 deletions
diff --git a/Bugzilla/Auth/Login/WWW/CGI.pm b/Bugzilla/Auth/Login/WWW/CGI.pm
index 42e454f86..47c2b92b7 100644
--- a/Bugzilla/Auth/Login/WWW/CGI.pm
+++ b/Bugzilla/Auth/Login/WWW/CGI.pm
@@ -184,7 +184,7 @@ sub login {
# If we get here, then we've run out of options, which shouldn't happen
ThrowCodeError("authres_unhandled", { authres => $authres,
- type => $type, });
+ type => $type });
}
# This auth style allows the user to log out.
diff --git a/Bugzilla/Bug.pm b/Bugzilla/Bug.pm
index a6758d36f..b2261e1ee 100755
--- a/Bugzilla/Bug.pm
+++ b/Bugzilla/Bug.pm
@@ -511,21 +511,18 @@ sub ValidateTime {
# (allow negatives, though, so people can back out errors in time reporting)
if ($time !~ /^-?(?:\d+(?:\.\d*)?|\.\d+)$/) {
ThrowUserError("number_not_numeric",
- {field => "$field", num => "$time"},
- "abort");
+ {field => "$field", num => "$time"});
}
# Only the "work_time" field is allowed to contain a negative value.
if ( ($time < 0) && ($field ne "work_time") ) {
ThrowUserError("number_too_small",
- {field => "$field", num => "$time", min_num => "0"},
- "abort");
+ {field => "$field", num => "$time", min_num => "0"});
}
if ($time > 99999.99) {
ThrowUserError("number_too_large",
- {field => "$field", num => "$time", max_num => "99999.99"},
- "abort");
+ {field => "$field", num => "$time", max_num => "99999.99"});
}
}
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.