]> git.donarmstrong.com Git - debbugs.git/commitdiff
[project @ 2002-12-07 01:44:30 by cjwatson]
authorcjwatson <>
Sat, 7 Dec 2002 09:44:30 +0000 (01:44 -0800)
committercjwatson <>
Sat, 7 Dec 2002 09:44:30 +0000 (01:44 -0800)
Improve the error message returned when querying non-existent bug numbers.

cgi/bugreport.cgi

index 3d90f7760f67e7722b6e9475025e0222123611ed..0063ad985500def2d8133fcf741e70d8027e2636 100755 (executable)
@@ -31,14 +31,13 @@ my %pkgsrc = %{getpkgsrc()};
 my $ref = $param{'bug'} || quit("No bug number");
 $ref =~ /(\d+)/ or quit("Invalid bug number");
 $ref = $1;
+my $short = "#$ref";
 my $msg = $param{'msg'} || "";
 my $att = $param{'att'};
 my $boring = ($param{'boring'} || 'no') eq 'yes'; 
 my $reverse = ($param{'reverse'} || 'no') eq 'yes';
 my $mbox = ($param{'mbox'} || 'no') eq 'yes'; 
 
-my %status = %{getbugstatus($ref)} or &quit("Couldn't get bug status: $!");
-
 my $indexentry;
 my $descriptivehead;
 my $showseverity;
@@ -53,6 +52,23 @@ my $dtime = strftime "%a, %e %b %Y %T UTC", localtime;
 $tail_html = $debbugs::gHTMLTail;
 $tail_html =~ s/SUBSTITUTE_DTIME/$dtime/;
 
+my %status = %{getbugstatus($ref)};
+unless (%status) {
+    print <<EOF;
+Content-Type: text/html
+
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<html>
+<head><title>$debbugs::gProject $debbugs::gBug report logs - $short</title></head>
+<body>
+<h1>$debbugs::gProject $debbugs::gBug report logs - $short</h1>
+<p>There is no record of $debbugs::gBug $short.
+Try the <a href="http://$debbugs::gWebDomain/">search page</a> instead.</p>
+$tail_html</body></html>
+EOF
+    exit 0;
+}
+
 $|=1;
 
 $tpack = lc $status{'package'};
@@ -102,8 +118,7 @@ if (length($status{done})) {
 
 $indexentry .= join(";\n", @descstates) . ";\n<br>" if @descstates;
 
-my ($short, $tmaint, $tsrc);
-$short = $ref; $short =~ s/^\d+/#$&/;
+my ($tmaint, $tsrc);
 $tmaint = defined($maintainer{$tpack}) ? $maintainer{$tpack} : '(unknown)';
 $tsrc = defined($pkgsrc{$tpack}) ? $pkgsrc{$tpack} : '(unknown)';
 $descriptivehead= $indexentry."Maintainer for $status{package} is\n".