OpenPKG CVS Repository
  http://cvs.openpkg.org/
  ____________________________________________________________________________

  Server: cvs.openpkg.org                  Name:   Thomas Lotterer
  Root:   /v/openpkg/cvs                   Email:  [EMAIL PROTECTED]
  Module: openpkg-registry                 Date:   24-Nov-2005 12:14:25
  Branch: HEAD                             Handle: 2005112411142500

  Modified files:
    openpkg-registry        registry-ui.pl

  Log:
    user friendly error messages

  Summary:
    Revision    Changes     Path
    1.8         +37 -11     openpkg-registry/registry-ui.pl
  ____________________________________________________________________________

  patch -p0 <<'@@ .'
  Index: openpkg-registry/registry-ui.pl
  ============================================================================
  $ cvs diff -u -r1.7 -r1.8 registry-ui.pl
  --- openpkg-registry/registry-ui.pl   24 Nov 2005 11:13:36 -0000      1.7
  +++ openpkg-registry/registry-ui.pl   24 Nov 2005 11:14:25 -0000      1.8
  @@ -126,17 +126,7 @@
   #
   $dbh = &dbopen("registry");
   if (not defined $dbh) {
  -    my $out;
  -    $out = '';
  -    $out .= &viewhttp();
  -    $out .= &viewhtmlhead();
  -    $out .= &viewmainform();
  -    $msg = $DBI::errstr;
  -    $msg =~ s/[ ]*ERROR:?[ ]*//;
  -    $msg =~ s/ for user.*$//;
  -    $out .= sprintf("<br><img src=\"?page=gif;name=icon-x\">&nbsp;ERROR 
accessing backend DataBase. Please come back later.\n");
  -    $out .= &viewhtmltail();
  -    print STDOUT $out;
  +    &printprettyerror("Registry database backend unavailable", &prettydbi());
       goto CUS;
   }
   
  @@ -807,6 +797,42 @@
       return $html;
   }
   
  +sub printprettyerror($$)
  +{
  +    my ($marketingmessage, $technicaldetail) = @_;
  +    my $out;
  +    $out = '';
  +    $out .= &viewhttp();
  +    $out .= &viewhtmlhead();
  +    $out .= &viewmainform();
  +    $out .= &viewprettyerror($marketingmessage, $technicaldetail);
  +    $out .= &viewhtmltail();
  +    print STDOUT $out;
  +}
  +
  +sub viewprettyerror($$)
  +{
  +    my ($marketingmessage, $technicaldetail) = @_;
  +    my $html;
  +
  +    $html .= '';
  +    $html .= "<h1>Sorry</h1>\n";
  +    $html .= "<img src=\"?page=gif;name=icon-x\">&nbsp;an internal 
<b>ERROR</b> occurred and prevents further processing.<br>\n";
  +    $html .= sprintf("<h2>Problem scope</h2>\n%s<br>\n", $marketingmessage) 
if (defined $marketingmessage and $marketingmessage ne "");
  +    $html .= sprintf("<h2>Technical details</h2>\n%s<br>\n", 
$technicaldetail) if (defined $technicaldetail and $technicaldetail ne "");
  +    $html .= "<h2>Please come back later and try again</h2>\nSorry for the 
inconvenience.\n";
  +    return $html
  +}
  +
  +sub prettydbi()
  +{
  +    my $msg;
  +    $msg = $DBI::errstr;
  +    $msg =~ s/[ ]*ERROR:?[ ]*//;
  +    $msg =~ s/ for user.*$//;
  +    return $msg;
  +}
  +
   sub viewlogin()
   {
       my ($header, $cookie, $redirect, $username);
  @@ .
______________________________________________________________________
The OpenPKG Project                                    www.openpkg.org
CVS Repository Commit List                     openpkg-cvs@openpkg.org

Reply via email to