Commit c558f9f5 authored by Frédéric Buclin's avatar Frédéric Buclin

Bug 565879: Merge ThrowCodeError("action_unrecognized"),…

Bug 565879: Merge ThrowCodeError("action_unrecognized"), ThrowUserError("no_valid_action") and ThrowCodeError("unknown_action") r=ghendricks a=LpSolit
parent d6e7e1bd
...@@ -127,7 +127,7 @@ elsif ($action eq "delete") { ...@@ -127,7 +127,7 @@ elsif ($action eq "delete") {
} }
else else
{ {
ThrowCodeError("unknown_action", { action => $action }); ThrowUserError('unknown_action', {action => $action});
} }
exit; exit;
......
...@@ -511,7 +511,7 @@ elsif (($cmdtype eq "doit") && defined $cgi->param('remtype')) { ...@@ -511,7 +511,7 @@ elsif (($cmdtype eq "doit") && defined $cgi->param('remtype')) {
# We add or remove bugs based on the action choosen. # We add or remove bugs based on the action choosen.
my $action = trim($cgi->param('action') || ''); my $action = trim($cgi->param('action') || '');
$action =~ /^(add|remove)$/ $action =~ /^(add|remove)$/
|| ThrowCodeError('unknown_action', {'action' => $action}); || ThrowUserError('unknown_action', {action => $action});
# If we are removing bugs, then we must have an existing # If we are removing bugs, then we must have an existing
# saved search selected. # saved search selected.
......
...@@ -227,7 +227,7 @@ elsif ($action eq "convert_search") { ...@@ -227,7 +227,7 @@ elsif ($action eq "convert_search") {
print $cgi->redirect(-location => correct_urlbase() . "query.cgi?format=create-series$url"); print $cgi->redirect(-location => correct_urlbase() . "query.cgi?format=create-series$url");
} }
else { else {
ThrowCodeError("unknown_action"); ThrowUserError('unknown_action', {action => $action});
} }
exit; exit;
......
...@@ -233,4 +233,4 @@ if ($action eq 'reclassify') { ...@@ -233,4 +233,4 @@ if ($action eq 'reclassify') {
# No valid action found # No valid action found
# #
ThrowCodeError("action_unrecognized", {action => $action}); ThrowUserError('unknown_action', {action => $action});
...@@ -252,7 +252,5 @@ if ($action eq 'update') { ...@@ -252,7 +252,5 @@ if ($action eq 'update') {
exit; exit;
} }
#
# No valid action found # No valid action found
# ThrowUserError('unknown_action', {action => $action});
ThrowUserError('no_valid_action', {'field' => "component"});
...@@ -171,5 +171,5 @@ elsif ($action eq 'delete') { ...@@ -171,5 +171,5 @@ elsif ($action eq 'delete') {
|| ThrowTemplateError($template->error()); || ThrowTemplateError($template->error());
} }
else { else {
ThrowUserError('no_valid_action', {'field' => 'custom_field'}); ThrowUserError('unknown_action', {action => $action});
} }
...@@ -86,7 +86,7 @@ elsif ($action eq 'confirmdelete') { confirmDelete(); } ...@@ -86,7 +86,7 @@ elsif ($action eq 'confirmdelete') { confirmDelete(); }
elsif ($action eq 'delete') { deleteType($token); } elsif ($action eq 'delete') { deleteType($token); }
elsif ($action eq 'deactivate') { deactivate($token); } elsif ($action eq 'deactivate') { deactivate($token); }
else { else {
ThrowCodeError("action_unrecognized", { action => $action }); ThrowUserError('unknown_action', {action => $action});
} }
exit; exit;
......
...@@ -357,13 +357,8 @@ if ($action eq 'remove_regexp') { ...@@ -357,13 +357,8 @@ if ($action eq 'remove_regexp') {
exit; exit;
} }
#
# No valid action found # No valid action found
# ThrowUserError('unknown_action', {action => $action});
ThrowCodeError("action_unrecognized", $vars);
# Helper sub to handle the making of changes to a group # Helper sub to handle the making of changes to a group
sub doGroupChanges { sub doGroupChanges {
......
...@@ -183,4 +183,4 @@ if ($action eq 'delete') { ...@@ -183,4 +183,4 @@ if ($action eq 'delete') {
exit; exit;
} }
ThrowCodeError("action_unrecognized", $vars); ThrowUserError('unknown_action', {action => $action});
...@@ -218,7 +218,5 @@ if ($action eq 'update') { ...@@ -218,7 +218,5 @@ if ($action eq 'update') {
exit; exit;
} }
#
# No valid action found # No valid action found
# ThrowUserError('unknown_action', {action => $action});
ThrowUserError('no_valid_action', {'field' => "target_milestone"});
...@@ -422,8 +422,5 @@ if ($action eq 'updategroupcontrols') { ...@@ -422,8 +422,5 @@ if ($action eq 'updategroupcontrols') {
exit; exit;
} }
#
# No valid action found # No valid action found
# ThrowUserError('unknown_action', {action => $action});
ThrowUserError('no_valid_action', {field => "product"});
...@@ -675,8 +675,7 @@ if ($action eq 'search') { ...@@ -675,8 +675,7 @@ if ($action eq 'search') {
########################################################################### ###########################################################################
} else { } else {
$vars->{'action'} = $action; ThrowUserError('unknown_action', {action => $action});
ThrowCodeError('action_unrecognized', $vars);
} }
exit; exit;
......
...@@ -193,10 +193,5 @@ if ($action eq 'update') { ...@@ -193,10 +193,5 @@ if ($action eq 'update') {
display_field_values($vars); display_field_values($vars);
} }
#
# No valid action found # No valid action found
# ThrowUserError('unknown_action', {action => $action});
# We can't get here without $field being defined --
# See the unless($field) block at the top.
ThrowUserError('no_valid_action', { field => $field } );
...@@ -219,7 +219,5 @@ if ($action eq 'update') { ...@@ -219,7 +219,5 @@ if ($action eq 'update') {
exit; exit;
} }
#
# No valid action found # No valid action found
# ThrowUserError('unknown_action', {action => $action});
ThrowUserError('no_valid_action', {'field' => "version"});
...@@ -147,5 +147,5 @@ elsif ($action eq 'update_comment') { ...@@ -147,5 +147,5 @@ elsif ($action eq 'update_comment') {
load_template('comment', 'workflow_updated'); load_template('comment', 'workflow_updated');
} }
else { else {
ThrowCodeError("action_unrecognized", {action => $action}); ThrowUserError('unknown_action', {action => $action});
} }
...@@ -190,7 +190,7 @@ elsif ($action eq 'end-sudo') { ...@@ -190,7 +190,7 @@ elsif ($action eq 'end-sudo') {
# No valid action found # No valid action found
else { else {
Bugzilla->login(LOGIN_OPTIONAL); Bugzilla->login(LOGIN_OPTIONAL);
ThrowCodeError('unknown_action', {action => $action}); ThrowUserError('unknown_action', {action => $action});
} }
# Display the template # Display the template
......
...@@ -289,7 +289,7 @@ elsif ($action eq "plot") { ...@@ -289,7 +289,7 @@ elsif ($action eq "plot") {
$vars->{'data'} = \@image_data; $vars->{'data'} = \@image_data;
} }
else { else {
ThrowCodeError("unknown_action", {action => $cgi->param('action')}); ThrowUserError('unknown_action', {action => $action});
} }
my $format = $template->get_format("reports/report", $formatparam, my $format = $template->get_format("reports/report", $formatparam,
......
...@@ -37,13 +37,7 @@ ...@@ -37,13 +37,7 @@
[% DEFAULT title = "Internal Error" %] [% DEFAULT title = "Internal Error" %]
[% error_message = BLOCK %] [% error_message = BLOCK %]
[% IF error == "action_unrecognized" %] [% IF error == "attachment_local_storage_disabled" %]
[% docslinks = {'query.html' => "Searching for $terms.bugs",
'query.html#list' => "$terms.Bug lists"} %]
I don't recognize the value (<em>[% action FILTER html %]</em>)
of the <em>action</em> variable.
[% ELSIF error == "attachment_local_storage_disabled" %]
[% title = "Local Storage Disabled" %] [% title = "Local Storage Disabled" %]
You cannot store attachments locally. This feature is disabled. You cannot store attachments locally. This feature is disabled.
...@@ -450,13 +444,6 @@ ...@@ -450,13 +444,6 @@
[% ELSIF error == "undefined_field" %] [% ELSIF error == "undefined_field" %]
Form field [% field FILTER html %] was not defined. Form field [% field FILTER html %] was not defined.
[% ELSIF error == "unknown_action" %]
[% IF action %]
Unknown action [% action FILTER html %]!
[% ELSE %]
I could not figure out what you wanted to do.
[% END %]
[% ELSIF error == "unknown_method" %] [% ELSIF error == "unknown_method" %]
The requested method '[% method FILTER html %]' was not found. The requested method '[% method FILTER html %]' was not found.
......
...@@ -1251,10 +1251,6 @@ ...@@ -1251,10 +1251,6 @@
Either no products have been defined to enter [% terms.bugs %] against or you have not Either no products have been defined to enter [% terms.bugs %] against or you have not
been given access to any. been given access to any.
[% ELSIF error == "no_valid_action" %]
[% title = "No valid action specified" %]
Cannot edit [% field_descs.$field FILTER html %]: no valid action was specified.
[% ELSIF error == "number_not_numeric" %] [% ELSIF error == "number_not_numeric" %]
[% title = "Numeric Value Required" %] [% title = "Numeric Value Required" %]
The value '[% num FILTER html %]' in the The value '[% num FILTER html %]' in the
...@@ -1581,6 +1577,13 @@ ...@@ -1581,6 +1577,13 @@
[% END %] [% END %]
token too recently to request another. Please wait a while and try again. token too recently to request another. Please wait a while and try again.
[% ELSIF error == "unknown_action" %]
[% IF action %]
Unknown action [% action FILTER html %]!
[% ELSE %]
I could not figure out what you wanted to do.
[% END %]
[% ELSIF error == "unknown_keyword" %] [% ELSIF error == "unknown_keyword" %]
[% title = "Unknown Keyword" %] [% title = "Unknown Keyword" %]
<code>[% keyword FILTER html %]</code> is not a known keyword. <code>[% keyword FILTER html %]</code> is not a known keyword.
......
...@@ -56,7 +56,7 @@ Bugzilla->login(LOGIN_OPTIONAL); ...@@ -56,7 +56,7 @@ Bugzilla->login(LOGIN_OPTIONAL);
# Throw an error if the form does not contain an "action" field specifying # Throw an error if the form does not contain an "action" field specifying
# what the user wants to do. # what the user wants to do.
$action || ThrowCodeError("unknown_action"); $action || ThrowUserError('unknown_action');
# If a token was submitted, make sure it is a valid token that exists in the # If a token was submitted, make sure it is a valid token that exists in the
# database and is the correct type for the action being taken. # database and is the correct type for the action being taken.
...@@ -163,10 +163,7 @@ if ($action eq 'reqpw') { ...@@ -163,10 +163,7 @@ if ($action eq 'reqpw') {
} elsif ($action eq 'cancel_new_account') { } elsif ($action eq 'cancel_new_account') {
cancel_create_account($token); cancel_create_account($token);
} else { } else {
# If the action that the user wants to take (specified in the "a" form field) ThrowUserError('unknown_action', {action => $action});
# is none of the above listed actions, display an error telling the user
# that we do not understand what they would like to do.
ThrowCodeError("unknown_action", { action => $action });
} }
exit; exit;
......
...@@ -41,7 +41,7 @@ elsif ($action eq "show_user" or $action eq 'vote') { ...@@ -41,7 +41,7 @@ elsif ($action eq "show_user" or $action eq 'vote') {
$cgi->param('id', 'voting/user.html'); $cgi->param('id', 'voting/user.html');
} }
else { else {
ThrowCodeError("unknown_action", {action => $action}); ThrowUserError('unknown_action', {action => $action});
} }
print $cgi->redirect('page.cgi?' . $cgi->query_string); print $cgi->redirect('page.cgi?' . $cgi->query_string);
......
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