]> git.ipfire.org Git - thirdparty/bugzilla.git/commitdiff
Bug 162066 - Fix callers of ThrowCodeError to use messages in code-error.html.tmpl...
authorgerv%gerv.net <>
Fri, 16 Aug 2002 06:01:20 +0000 (06:01 +0000)
committergerv%gerv.net <>
Fri, 16 Aug 2002 06:01:20 +0000 (06:01 +0000)
Bugzilla/Search.pm
bug_form.pl
template/en/default/global/code-error.html.tmpl

index 88687392fc818027ce6c71a924b7f135a2a8c515..50b3ad19c917555d19b113c0f2c03fe9518855fc 100644 (file)
@@ -95,7 +95,7 @@ sub init {
         my $c = &::trim($F{'votes'});
         if ($c ne "") {
             if ($c !~ /^[0-9]*$/) {
-                $vars->{'value'} = $c;
+                $::vars->{'value'} = $c;
                 &::ThrowUserError("illegal_at_least_x_votes");
             }
             push(@specialchart, ["votes", "greaterthan", $c - 1]);
@@ -179,7 +179,7 @@ sub init {
         if (@clist) {
             push(@specialchart, \@clist);
         } else {
-            $vars->{'email'} = $email;
+            $::vars->{'email'} = $email;
             &::ThrowUserError("missing_email_type");
         }
     }
@@ -189,7 +189,7 @@ sub init {
         my $c = &::trim($F{'changedin'});
         if ($c ne "") {
             if ($c !~ /^[0-9]*$/) {
-                $vars->{'value'} = $c;
+                $::vars->{'value'} = $c;
                 &::ThrowUserError("illegal_changed_in_last_x_days");
             }
             push(@specialchart, ["changedin",
@@ -437,7 +437,7 @@ sub init {
                      push(@list, "$table.keywordid = $id");
                  }
                  else {
-                     $vars->{'keyword'} = $v;
+                     $::vars->{'keyword'} = $v;
                      &::ThrowUserError("unknown_keyword");
                  }
              }
@@ -776,11 +776,10 @@ sub init {
                     push(@orlist, $term);
                 }
                 else {
-                    my $errstr =
-                      qq|Cannot seem to handle <code>$F{"field$chart-$row-$col"}</code>
-                         and <code>$F{"type$chart-$row-$col"}</code> together|;
-                    $chart < 0 ? die "Internal error: $errstr"
-                               : &::ThrowCodeError($errstr);
+                    # This field and this type don't work together.
+                    $::vars->{'field'} = $F{"field$chart-$row-$col"};
+                    $::vars->{'type'} = $F{"type$chart-$row-$col"};
+                    &::ThrowCodeError("field_type_mismatch");
                 }
             }
             if (@orlist) {
@@ -842,7 +841,7 @@ sub SqlifyDate {
     }
     my $date = str2time($str);
     if (!defined($date)) {
-        $vars->{'date'} = $str;
+        $::vars->{'date'} = $str;
         ThrowUserError("illegal_date");
     }
     return time2str("%Y-%m-%d %H:%M:%S", $date);
index b04208bdf7c02bc3a727f85f772e8e1d4524241c..c4d623e129f389042743403d33306ee8af90eab7 100644 (file)
@@ -96,7 +96,8 @@ sub show_bug {
     # The caller is meant to have checked this. Abort here so that
     # we don't get obscure SQL errors, below
     if (!MoreSQLData()) {
-        ThrowCodeError("No data when fetching bug $id");
+        $vars->{'bug_id'} = $id;
+        ThrowCodeError("no_bug_data");
     }
 
     my $value;
index d731dbc494fcd75fa0bf5c0ae1a6c666d4dab009..65f8bf67239dda3110b8d48894390903c7788c77 100644 (file)
     to any [% parameters %] which you may have set before calling
     ThrowCodeError.
 
+  [% ELSIF error == "field_type_mismatch" %]
+    Cannot seem to handle <code>[% field %]</code>
+    and <code>[% type %]</code> together.
   [% ELSIF error == "group_bit_invalid" %]
     One of the group bits submitted was invalid.
 
@@ -52,6 +56,9 @@
     Attempted to add bug to an inactive group, identified by the bit 
     '[% bit FILTER html %]'.
     
+  [% ELSIF error == "no_bug_data" %]
+    No data when fetching bug [% bug_id %].
+    
   [% ELSIF error == "template_error" %]
     [% template_error_msg %]
 
     Unknown action [% action FILTER html %]!
     
   [% ELSE %]
-    [%# Cope with legacy calling convention, where "error" was the string
-      # to print. 
-      #%]
-        
-    [% error %]
+    [%# Give sensible error if error functions are used incorrectly.
+      #%]        
+    You are using Bugzilla's ThrowCodeError() function incorrectly. You
+    passed in the string '[% message_tag %]'. The correct use is to pass
+    in a tag, and define that tag in the file code-error.html.tmpl.<br>
+    <br>
+    If you are a Bugzilla end-user seeing this message, please save this
+    page and send it to [% Param('maintainer') %].
   [% END %]
 [% END %]