[tools 2/2] testbot/cgi: Show all errors, even about hidden parameters.

Francois Gouget fgouget at codeweavers.com
Wed Mar 2 10:02:34 CST 2022


Hiding errors related to hidden parameters causes actions to have no
effect which is very confusing.
So show these errors too but prefix them with text hinting they are
likely internal errors.

Signed-off-by: Francois Gouget <fgouget at codeweavers.com>
---
Note that the linefeed in the error message requires the previous patch
for proper handling.

When I first added tables for the random failures blacklisting (bug
48912), clicking on the form's "Save" button had no effect whatsoever
because this function was hiding the errors. The issue was some hidden
fields had invalid default values, causing the database save to fail.
This patch will make such issues trivial to diagnose. Should they happen
in the wild they should also get us better bug reports.
---
 testbot/lib/ObjectModel/CGI/FormPage.pm | 17 ++++++++---------
 1 file changed, 8 insertions(+), 9 deletions(-)

diff --git a/testbot/lib/ObjectModel/CGI/FormPage.pm b/testbot/lib/ObjectModel/CGI/FormPage.pm
index 735755f3cf..0ac599e137 100644
--- a/testbot/lib/ObjectModel/CGI/FormPage.pm
+++ b/testbot/lib/ObjectModel/CGI/FormPage.pm
@@ -108,18 +108,17 @@ sub GenerateBody($)
   $self->GenerateFields();
   $self->GenerateRequiredLegend();
 
-  if (defined($self->{ErrMessage}))
+  if (defined $self->{ErrMessage})
   {
-    my $PropertyDescriptor;
-    if (defined($self->{ErrField}))
+    if (defined $self->{ErrField})
     {
-      $PropertyDescriptor = $self->GetPropertyDescriptorByName($self->{ErrField});
-    }
-    if (! defined($PropertyDescriptor) ||
-        $self->DisplayProperty($PropertyDescriptor))
-    {
-      $self->GenerateErrorPopup();
+      my $PropertyDescriptor = $self->GetPropertyDescriptorByName($self->{ErrField});
+      if ($PropertyDescriptor and !$self->DisplayProperty($PropertyDescriptor))
+      {
+        $self->{ErrMessage} = "Internal error?\n$self->{ErrMessage}";
+      }
     }
+    $self->GenerateErrorPopup();
   }
   $self->GenerateActions();
   $self->GenerateFormEnd();
-- 
2.30.2



More information about the wine-devel mailing list