Graceful destruction on errors where plugins don't compile or follow API.

This commit is contained in:
JT Smith 2002-06-06 04:24:36 +00:00
parent 337db77f48
commit 1ac2bbd738
3 changed files with 18 additions and 7 deletions

View file

@ -33,7 +33,8 @@ sub process {
$output = $_[0];
foreach $macro (keys %{$session{macro}}) {
$cmd = "WebGUI::Macro::".$macro."::process";
$output = &$cmd($output);
$output = eval{&$cmd($output)};
WebGUI::ErrorHandler::fatalError("Processing failed on macro: $macro.") if($@);
}
return $output;
}

View file

@ -16,6 +16,7 @@ use DBI;
use Exporter;
use strict;
use Tie::CPHash;
use WebGUI::ErrorHandler;
use WebGUI::SQL;
our @ISA = qw(Exporter);
@ -118,6 +119,7 @@ sub _loadMacros {
$namespace = $1;
$cmd = "use WebGUI::Macro::".$1;
eval($cmd);
WebGUI::ErrorHandler::fatalError("Macro failed to compile: $namespace.") if($@);
$session{macro}{$namespace} = $namespace;
}
}
@ -139,8 +141,10 @@ sub _loadWobjects {
$namespace = $1;
$cmd = "use WebGUI::Wobject::".$namespace;
eval($cmd);
WebGUI::ErrorHandler::fatalError("Wobject failed to compile: $namespace.") if($@);
$cmd = "\$WebGUI::Wobject::".$namespace."::name";
$session{wobject}{$namespace} = eval($cmd);
WebGUI::ErrorHandler::fatalError("No name method in wobject: $namespace.") if($@);
}
}
closedir(DIR);