Commit 46c89016 authored by lpsolit%gmail.com's avatar lpsolit%gmail.com

Bug 312307: Misused Throw*Error tags in code and templates - Patch by Dennis…

Bug 312307: Misused Throw*Error tags in code and templates - Patch by Dennis Melentyev <dennis.melentyev@infopulse.com.ua> r=LpSolit a=justdave
parent d0042bb7
...@@ -334,10 +334,7 @@ GetVersionTable(); ...@@ -334,10 +334,7 @@ GetVersionTable();
my $product_id = get_product_id($product); my $product_id = get_product_id($product);
if (0 == @{$::components{$product}}) { if (1 == @{$::components{$product}}) {
ThrowUserError("no_components", {product => $product});
}
elsif (1 == @{$::components{$product}}) {
# Only one component; just pick it. # Only one component; just pick it.
$cgi->param('component', $::components{$product}->[0]); $cgi->param('component', $::components{$product}->[0]);
} }
......
...@@ -328,7 +328,7 @@ foreach my $b (grep(/^bit-\d*$/, $cgi->param())) { ...@@ -328,7 +328,7 @@ foreach my $b (grep(/^bit-\d*$/, $cgi->param())) {
if ($cgi->param($b)) { if ($cgi->param($b)) {
my $v = substr($b, 4); my $v = substr($b, 4);
detaint_natural($v) detaint_natural($v)
|| ThrowCodeError("group_id_invalid"); || ThrowUserError("invalid_group_ID");
if (!GroupIsActive($v)) { if (!GroupIsActive($v)) {
# Prevent the user from adding the bug to an inactive group. # Prevent the user from adding the bug to an inactive group.
# Should only happen if there is a bug in Bugzilla or the user # Should only happen if there is a bug in Bugzilla or the user
......
...@@ -56,7 +56,7 @@ if ($action eq 'sudo') { ...@@ -56,7 +56,7 @@ if ($action eq 'sudo') {
# Do not try to start a new session if one is already in progress! # Do not try to start a new session if one is already in progress!
if (defined(Bugzilla->sudoer)) { if (defined(Bugzilla->sudoer)) {
ThrowUserError('sudo-in-progress', { target => $user->login }); ThrowUserError('sudo_in_progress', { target => $user->login });
} }
# We may have been given a value to put into the field # We may have been given a value to put into the field
......
...@@ -290,7 +290,7 @@ elsif ($action eq "plot") { ...@@ -290,7 +290,7 @@ elsif ($action eq "plot") {
$vars->{'data'} = \@image_data; $vars->{'data'} = \@image_data;
} }
else { else {
ThrowUserError("unknown_action", {action => $cgi->param('action')}); ThrowCodeError("unknown_action", {action => $cgi->param('action')});
} }
my $format = $template->get_format("reports/report", $formatparam, my $format = $template->get_format("reports/report", $formatparam,
......
...@@ -154,11 +154,6 @@ ...@@ -154,11 +154,6 @@
[%+ terms.bug %] [%+ bug_id FILTER html %]. [%+ terms.bug %] [%+ bug_id FILTER html %].
[% END %] [% END %]
[% ELSIF error == "invalid_isactive_flag" %]
[% title = "Invalid isactive flag" %]
The active flag was improperly set. There may be
a problem with [% terms.Bugzilla %] or [% terms.abug %] in your browser.
[% ELSIF error == "invalid_numeric_argument" %] [% ELSIF error == "invalid_numeric_argument" %]
[% title = "Invalid number argument" %] [% title = "Invalid number argument" %]
The argument <code>[% argument FILTER html %] = [% value FILTER html %]</code> The argument <code>[% argument FILTER html %] = [% value FILTER html %]</code>
...@@ -245,13 +240,12 @@ ...@@ -245,13 +240,12 @@
[%+ series.subcategory FILTER html %] / [%+ series.subcategory FILTER html %] /
[%+ series.name FILTER html %]. [%+ series.name FILTER html %].
[% ELSIF error == "no_y_axis_defined" %]
No Y axis was defined when creating report. The X axis is optional,
but the Y axis is compulsory.
[% ELSIF error == "need_quipid" %] [% ELSIF error == "need_quipid" %]
A valid quipid is needed. A valid quipid is needed.
[% ELSIF error == "unknown_comparison_type" %]
Specified comparison type is not supported.
[% ELSIF error == "request_queue_group_invalid" %] [% ELSIF error == "request_queue_group_invalid" %]
The group field <em>[% group FILTER html %]</em> is invalid. The group field <em>[% group FILTER html %]</em> is invalid.
...@@ -298,6 +292,10 @@ ...@@ -298,6 +292,10 @@
I could not figure out what you wanted to do. I could not figure out what you wanted to do.
[% END %] [% END %]
[% ELSIF error == "must_be_patch" %]
[% title = "Attachment Must Be Patch" %]
Attachment #[% attach_id FILTER html %] must be a patch.
[% ELSIF error == "nested_transaction" %] [% ELSIF error == "nested_transaction" %]
Attempted to start a new transaction without finishing previous one first. Attempted to start a new transaction without finishing previous one first.
......
...@@ -276,15 +276,6 @@ ...@@ -276,15 +276,6 @@
You must reassign those [% terms.bugs %] to another component before you You must reassign those [% terms.bugs %] to another component before you
can delete this one. can delete this one.
[% ELSIF error == "component_must_have_a_name" %]
[% title = "Blank Component Name Not Allowed" %]
You cannot delete the component name for component '[% name FILTER html %]'.
[% ELSIF error == "component_cant_del_description" %]
[% title = "Blank Component Description Not Allowed" %]
You cannot delete the component description for
component '[% name FILTER html %]'.
[% ELSIF error == "component_name_too_long" %] [% ELSIF error == "component_name_too_long" %]
[% title = "Component Name Is Too Long" %] [% title = "Component Name Is Too Long" %]
The name of a component is limited to 64 characters. The name of a component is limited to 64 characters.
...@@ -294,10 +285,6 @@ ...@@ -294,10 +285,6 @@
[% title = "Component Requires Default Assignee" %] [% title = "Component Requires Default Assignee" %]
You must enter a default assignee for component '[% name FILTER html %]'. You must enter a default assignee for component '[% name FILTER html %]'.
[% ELSIF error == "component_not_specified" %]
[% title = "No Component Specified" %]
No component specified when trying to edit components.
[% ELSIF error == "component_not_valid" %] [% ELSIF error == "component_not_valid" %]
[% title = "Specified Component Does Not Exist" %] [% title = "Specified Component Does Not Exist" %]
The component '[% name FILTER html %]' for product The component '[% name FILTER html %]' for product
...@@ -601,11 +588,6 @@ ...@@ -601,11 +588,6 @@
You are not authorised to edit this series. To do this, you must either You are not authorised to edit this series. To do this, you must either
be its creator, or an administrator. be its creator, or an administrator.
[% ELSIF error == "insufficient_data" %]
[% title = "Insufficient Data" %]
None of the series you selected have any data associated with them, so a
chart cannot be plotted.
[% ELSIF error == "insufficient_data_points" %] [% ELSIF error == "insufficient_data_points" %]
We don't have enough data points to make a graph (yet). We don't have enough data points to make a graph (yet).
...@@ -842,10 +824,6 @@ ...@@ -842,10 +824,6 @@
Sorry, [% terms.bug %] moving has been disabled. If you need Sorry, [% terms.bug %] moving has been disabled. If you need
to move [% terms.abug %], please contact [% Param("maintainer") %]. to move [% terms.abug %], please contact [% Param("maintainer") %].
[% ELSIF error == "must_be_patch" %]
[% title = "Attachment Must Be Patch" %]
Attachment #[% attach_id FILTER html %] must be a patch.
[% ELSIF error == "missing_subcategory" %] [% ELSIF error == "missing_subcategory" %]
[% title = "Missing Subcategory" %] [% title = "Missing Subcategory" %]
You did not specify a subcategory for this series. You did not specify a subcategory for this series.
...@@ -1077,10 +1055,6 @@ ...@@ -1077,10 +1055,6 @@
To reassign [% terms.abug %], you must provide an address for To reassign [% terms.abug %], you must provide an address for
the new assignee. the new assignee.
[% ELSIF error == "report_access_denied" %]
[% title = "Access Denied" %]
You do not have the permissions necessary to view reports for this product.
[% ELSIF error == "require_component" %] [% ELSIF error == "require_component" %]
[% title = "Component Needed" %] [% title = "Component Needed" %]
To file this [% terms.bug %], you must first choose a component. To file this [% terms.bug %], you must first choose a component.
...@@ -1199,11 +1173,6 @@ ...@@ -1199,11 +1173,6 @@
version! You must reassign those [% terms.bugs %] to another version version! You must reassign those [% terms.bugs %] to another version
before you can delete this one. before you can delete this one.
[% ELSIF error == "version_name_too_long" %]
[% title = "Version Name Is Too Long" %]
The name of a version is limited to 20 characters.
'[% name FILTER html %]' is too long ([% name.length %] characters).
[% ELSIF error == "version_not_specified" %] [% ELSIF error == "version_not_specified" %]
[% title = "No Version Specified" %] [% title = "No Version Specified" %]
No version specified when trying to edit versions. No version specified when trying to edit versions.
...@@ -1239,15 +1208,14 @@ ...@@ -1239,15 +1208,14 @@
[% title = "Wrong Token" %] [% title = "Wrong Token" %]
That token cannot be used to change your password. That token cannot be used to change your password.
[% ELSIF error == "extern_id_conflict" %]
[% title = "Extern ID Conflict" %]
Someone with a different external ID has that address.
[% ELSIF error == "wrong_token_for_confirming_email_change" %] [% ELSIF error == "wrong_token_for_confirming_email_change" %]
[% title = "Wrong Token" %] [% title = "Wrong Token" %]
That token cannot be used to change your email address. That token cannot be used to change your email address.
[% ELSIF error == "value_out_of_range" %]
[% title = "Value Out Of Range" %]
Value is out of range for field
<em>[% field_descs.$field FILTER html %]</em>.
[% ELSIF error == "zero_length_file" %] [% ELSIF error == "zero_length_file" %]
[% title = "File Is Empty" %] [% title = "File Is Empty" %]
The file you are trying to attach is empty! The file you are trying to attach is empty!
......
...@@ -67,10 +67,8 @@ if ($cgi->param('t')) { ...@@ -67,10 +67,8 @@ if ($cgi->param('t')) {
$::token = $cgi->param('t'); $::token = $cgi->param('t');
# Make sure the token contains only valid characters in the right amount. # Make sure the token contains only valid characters in the right amount.
my $validationerror = ValidatePassword($::token); # Validate password will throw an error if token is invalid
if ($validationerror) { ValidatePassword($::token);
ThrowUserError("token_invalid");
}
trick_taint($::token); # Only used in placeholders trick_taint($::token); # Only used in placeholders
Bugzilla::Token::CleanTokenTable(); Bugzilla::Token::CleanTokenTable();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment