Created
March 30, 2010 21:00
-
-
Save perlDreamer/349588 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/lib/WebGUI/SQL.pm b/lib/WebGUI/SQL.pm | |
index 0d54902..bbbe1d7 100644 | |
--- a/lib/WebGUI/SQL.pm | |
+++ b/lib/WebGUI/SQL.pm | |
@@ -429,9 +429,9 @@ sub connect { | |
my $params = shift; | |
my (undef, $driver) = DBI->parse_dsn($dsn); | |
- my $dbh = DBI->connect($dsn,$user,$pass,{RaiseError => 0, AutoCommit => 1, | |
+ my $dbh = eval { DBI->connect($dsn,$user,$pass,{RaiseError => 0, AutoCommit => 1, | |
$driver eq 'mysql' ? (mysql_enable_utf8 => 1) : (), | |
- }); | |
+ }); }; | |
unless (defined $dbh) { | |
$session->errorHandler->error("Couldn't connect to database: $dsn : $DBI::errstr"); | |
diff --git a/lib/WebGUI/Session/ErrorHandler.pm b/lib/WebGUI/Session/ErrorHandler.pm | |
index 917fb6e..8b4296f 100644 | |
--- a/lib/WebGUI/Session/ErrorHandler.pm | |
+++ b/lib/WebGUI/Session/ErrorHandler.pm | |
@@ -232,6 +232,7 @@ sub fatal { | |
if (! defined $self->session->db(1)) { | |
# We can't even _determine_ whether we can show the debug text. Punt. | |
$self->session->output->print("<h1>Fatal Internal Error</h1>"); | |
+ $self->session->output->print("<p>".$message."</p>"); | |
} | |
elsif ($self->canShowDebug()) { | |
$self->session->output->print("<h1>WebGUI Fatal Error</h1><p>Something unexpected happened that caused this system to fault.</p>\n",1); | |
@@ -249,7 +250,7 @@ sub fatal { | |
$self->session->output->print('<br />'.$self->session->setting->get("companyURL"),1); | |
} | |
$self->session->close(); | |
- last WEBGUI_FATAL; | |
+ die "Fatal WebGUI error"; | |
} | |
diff --git a/lib/WebGUI/URL/Content.pm b/lib/WebGUI/URL/Content.pm | |
index 14a2d8f..49c2a5c 100644 | |
--- a/lib/WebGUI/URL/Content.pm | |
+++ b/lib/WebGUI/URL/Content.pm | |
@@ -65,7 +65,8 @@ sub handler { | |
$request->push_handlers(PerlResponseHandler => sub { | |
my $session = $request->pnotes('wgSession'); | |
unless (defined $session) { | |
- $session = WebGUI::Session->open($server->dir_config('WebguiRoot'), $config->getFilename, $request, $server); | |
+ $session = eval { WebGUI::Session->open($server->dir_config('WebguiRoot'), $config->getFilename, $request, $server); }; | |
+ return Apache2::Const::OK if ! defined $session; | |
} | |
WEBGUI_FATAL: foreach my $handler (@{$config->get("contentHandlers")}) { | |
my $output = eval { WebGUI::Pluggable::run($handler, "handler", [ $session ] )}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment