[Lxr-commits] CVS: lxr diff, 1.32, 1.33 ident, 1.38, 1.39 search, 1.51, 1.52 showconfig, 1.3, 1.4
Brought to you by:
ajlittoz
From: Andre-Littoz <ajl...@us...> - 2013-11-08 14:22:28
|
Update of /cvsroot/lxr/lxr In directory sfp-cvs-1.v30.ch3.sourceforge.com:/tmp/cvs-serv32081 Modified Files: diff ident search showconfig Log Message: Common.pm, consequently diff, indent, search, showconfig, Config.pm, Template.pm, CVS.pm, GIT.pm, Mercurial.pm, Subversion.pm, Generic.pm Uniformised error handling through warn and die after making sure HTTP headers are alway sent before printing anything. Since something is (nearly) always printed on screen, there is no longer need, except in exceptional circumstances to check error log files. Index: diff =================================================================== RCS file: /cvsroot/lxr/lxr/diff,v retrieving revision 1.32 retrieving revision 1.33 diff -u -d -r1.32 -r1.33 --- diff 24 Sep 2013 08:14:36 -0000 1.32 +++ diff 8 Nov 2013 14:22:25 -0000 1.33 @@ -241,8 +241,7 @@ unless (open(DIFF, '-|')) { open(STDERR, '>&STDOUT'); exec('diff', '-U0', $origtemp, $difftemp); - print STDERR "*** Diff subprocess died unexpextedly: $!\n"; - exit; + die "*** Diff subprocess died unexpectedly: $!\n"; } my ($os, $ol, $ns, $nl, $ms, $ml, $bo, $ofs, $dir, %orig, %new, %chg); Index: ident =================================================================== RCS file: /cvsroot/lxr/lxr/ident,v retrieving revision 1.38 retrieving revision 1.39 diff -u -d -r1.38 -r1.39 --- ident 24 Sep 2013 08:43:06 -0000 1.38 +++ ident 8 Nov 2013 14:22:25 -0000 1.39 @@ -551,10 +551,10 @@ $templ = gettemplate ( 'htmlident' , $errorsig - , "<h2 class\"error\">Identifier search not available without 'htmlident' template</h2>\n" + , '' ); - if ($templ =~ m/^$errorsig/) { - die "'htmlident' template not configured"; + if ($templ =~ m/^$errorsig/) { + die "Identifier search not available without 'htmlident' template\n"; } print( Index: search =================================================================== RCS file: /cvsroot/lxr/lxr/search,v retrieving revision 1.51 retrieving revision 1.52 diff -u -d -r1.51 -r1.52 --- search 24 Sep 2013 08:43:06 -0000 1.51 +++ search 8 Nov 2013 14:22:25 -0000 1.52 @@ -193,7 +193,7 @@ # The pattern to search for ." -y -n '$searchtext' 2>&1 |" ) - || print(STDERR "Glimpse subprocess died unexpextedly: $!\n"); + or die "Glimpse subprocess died unexpextedly: $!\n"; my $numlines = 0; my @glimpselines = (); @@ -524,10 +524,10 @@ $templ = gettemplate ( 'htmlsearch' , $errorsig - , "<h2 class\"error\">Free-text search not available without 'htmlsearch' template</h2>\n" + , '' ); if ($templ =~ m/^$errorsig/) { - die "'htmlsearch' template not configured"; + die "Free-text search not available without 'htmlsearch' template\n"; } my $searchtext = $HTTP->{'param'}{'_string'}; @@ -544,32 +544,29 @@ } elsif ($config->{'swishbin'} && $config->{'swishdir'}) { @results = swishsearch($searchtext, $filetext, $advanced, $casesensitive); } else { - warning('No freetext search engine configured.'); + warn "No freetext search engine configured.\n"; } } elsif ($filetext ne '') { my $FILELISTING; if ($config->{'swishdir'} && $config->{'swishbin'}) { unless ($FILELISTING = IO::File->new($config->{'swishdir'} . "/$releaseid.filenames")) { - &warning( - "Version '$releaseid' has not been indexed and is unavailable for searching<br>Could not open " - . $config->{'swishdir'} - . "/$releaseid.filenames."); + warn "Version '$releaseid' has not been indexed and is unavailable for searching<br>Could not open " + . $config->{'swishdir'} + . "/$releaseid.filenames\n"; return; } } elsif ($config->{'glimpsedir'} && $config->{'glimpsebin'}) { unless ($FILELISTING = IO::File->new($config->{'glimpsedir'} . '/' . $releaseid . "/.glimpse_filenames")) { - &warning( - "Version '$releaseid' has not been indexed and is unavailable for searching<br>Could not open " - . $config->{'glimpsedir'} - . "/$releaseid/.glimpse_filenames."); + warn "Version '$releaseid' has not been indexed and is unavailable for searching\n" + . 'Could not open ' + . $config->{'glimpsedir'} + . "/$releaseid/.glimpse_filenames\n"; return; } } else { - warning( - 'Freetext search engine required for file search, and no freetext search engine is configured' - ); + warn "Freetext search engine required for file search, and no freetext search engine is configured\n"; return; } my $sourceroot = $config->{'sourceroot'} . '/' . $releaseid . '/'; @@ -619,12 +616,12 @@ || $config->{'swishbin'} && $config->{'swishbin'} =~ m!^(.*/)?true$! ) { - print "<h2 class='error'>Free-text search disabled by configuration file!</h2>\n"; + warn "Free-text search disabled by configuration file!\n"; } else { &search; } } else { - print "<h2 class='error'>Free-text search not available with VCSs!</h2>\n"; + warn "Free-text search not available with VCSs!\n"; } makefooter('search'); Index: showconfig =================================================================== RCS file: /cvsroot/lxr/lxr/showconfig,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- showconfig 24 Sep 2013 08:39:05 -0000 1.3 +++ showconfig 8 Nov 2013 14:22:25 -0000 1.4 @@ -331,7 +331,7 @@ , '' ); if ($templ =~ m/^$errorsig/) { - die "'htmlconfig' template not configured"; + die "Can't display configuration without 'htmlconfig' template\n"; } print expandtemplate ( $templ |