Skip to content

Commit

Permalink
Item13027: Partial fix for the "Unexpected error"
Browse files Browse the repository at this point in the history
I know that this really isn't right.  Search ought to catch and report
this within the %SEARCH macro, and not result in a crash.

This commit just reports the error to the UI, and also reports more
information for future "Unexpected" errors
  • Loading branch information
gac410 committed Sep 14, 2014
1 parent a07393b commit 96110fc
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion core/lib/Foswiki/UI.pm
Original file line number Diff line number Diff line change
Expand Up @@ -158,10 +158,12 @@ BEGIN {
use Error qw(:try);
use Assert;
use CGI ();
use Data::Dumper;

use Foswiki ();
use Foswiki::Request ();
use Foswiki::Response ();
use Foswiki::Infix::Error ();
use Foswiki::OopsException ();
use Foswiki::EngineException ();
use Foswiki::ValidationException ();
Expand Down Expand Up @@ -430,6 +432,15 @@ sub _execute {
}
$Foswiki::engine->finalizeError( $res, $session->{request} );
}
catch Foswiki::Infix::Error with {
my $e = shift;
$session ||= $Foswiki::Plugins::SESSION;
$res = $session->{response} if $session;
$res ||= new Foswiki::Response();
$res->header( -type => 'text/plain' );
$res->print("Foswiki::Infix error\n\n");
$res->print( Data::Dumper::Dumper( \$e ) );
}
catch Error::Simple with {

# Most usually a 'die'
Expand Down Expand Up @@ -466,9 +477,11 @@ sub _execute {
otherwise {

# Aargh! Should never get here
my $e = shift;
$res = new Foswiki::Response;
$res->header( -type => 'text/plain' );
$res->print("Unspecified error");
$res->print("Unspecified error\n\n");
$res->print( Data::Dumper::Dumper( \$e ) );
};
$session->finish() if $session;
return $res;
Expand Down

0 comments on commit 96110fc

Please sign in to comment.