Improved robustness and reload protection.

This commit is contained in:
Martin Kamerbeek 2010-07-07 12:21:16 +02:00
parent a858e8fb44
commit 913b4710e9
2 changed files with 23 additions and 4 deletions

View file

@ -21,7 +21,15 @@ sub handler {
my $func = 'www_' . ( $form->get('func') || 'view' );
my $id = $form->get('id');
my $object = WebGUI::Pluggable::instanciate( $class, 'new', [ $session, $id ] );
my $object = eval { WebGUI::Pluggable::instanciate( $class, 'new', [ $session, $id ] ) };
if ( $@ || !$object ) {
my $ac = WebGUI::AdminConsole->new( $session );
my $output = "Unable to instanciate object of class [$class] with id [$id] because: $@";
return $ac->render( $output, 'Error' );
};
return $object->$func if $object->can( $func );
return;