From: lpsolit%gmail.com <> Date: Sun, 4 Jun 2006 02:53:59 +0000 (+0000) Subject: Bug 340253: .cgi scripts should call Throw*Error() instead of die() - Patch by Frédér... X-Git-Tag: bugzilla-2.22.1~112 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=531bbf6b61e9aafdd77cc356b97407a9695ac1d4;p=thirdparty%2Fbugzilla.git Bug 340253: .cgi scripts should call Throw*Error() instead of die() - Patch by Frédéric Buclin r=vladd a=justdave --- diff --git a/process_bug.cgi b/process_bug.cgi index a8a0f5f0dc..726b78942c 100755 --- a/process_bug.cgi +++ b/process_bug.cgi @@ -1789,8 +1789,7 @@ foreach my $id (@idlist) { shift @oldlist; } else { if ($oldlist[0] != $newlist[0]) { - $dbh->bz_unlock_tables(UNLOCK_ABORT); - die "Error in list comparing code"; + ThrowCodeError('list_comparison_error'); } shift @oldlist; shift @newlist; diff --git a/reports.cgi b/reports.cgi index 5553f2c976..731618c0fe 100755 --- a/reports.cgi +++ b/reports.cgi @@ -233,7 +233,8 @@ sub chart_image_name { # and number if ($datasets !~ m/^[A-Za-z0-9:]+$/) { - die "Invalid datasets $datasets"; + $vars->{'datasets'} = $datasets; + ThrowUserError('invalid_datasets', $vars); } # Since we pass the tests, consider it OK diff --git a/template/en/default/global/code-error.html.tmpl b/template/en/default/global/code-error.html.tmpl index 141930b071..2a8ea1c0eb 100644 --- a/template/en/default/global/code-error.html.tmpl +++ b/template/en/default/global/code-error.html.tmpl @@ -163,7 +163,10 @@ [% title = "Invalid Series" %] The series_id [% series_id FILTER html %] is not valid. It may be that this series has been deleted. - + + [% ELSIF error == "list_comparison_error" %] + Unexpected error in list comparing code. + [% ELSIF error == "mismatched_bug_ids_on_obsolete" %] Attachment [% attach_id FILTER html %] ([% description FILTER html %]) is attached to [% terms.bug %] [%+ attach_bug_id FILTER html %], diff --git a/template/en/default/global/user-error.html.tmpl b/template/en/default/global/user-error.html.tmpl index d0f105ef75..3de6bc74e1 100644 --- a/template/en/default/global/user-error.html.tmpl +++ b/template/en/default/global/user-error.html.tmpl @@ -656,6 +656,11 @@ The context [% context FILTER html %] is invalid (must be a number, "file" or "patch"). + [% ELSIF error == "invalid_datasets" %] + [% title = "Invalid Datasets" %] + Invalid datasets [% datasets FILTER html %]. Only digits, + letters and colons are allowed. + [% ELSIF error == "invalid_format" %] [% title = "Invalid Format" %] The format "[% format FILTER html %]" is invalid (must be one of