Update of /cvsroot/openinteract/OpenInteract2/lib/OpenInteract2/Controller
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv17814/lib/OpenInteract2/Controller
Modified Files:
MainTemplate.pm
Log Message:
Stop controller execution after action if is_redirect. Also put action error handling in a separate function so that it can be overridden.
Index: MainTemplate.pm
===================================================================
RCS file: /cvsroot/openinteract/OpenInteract2/lib/OpenInteract2/Controller/MainTemplate.pm,v
retrieving revision 1.12
retrieving revision 1.13
diff -C2 -d -r1.12 -r1.13
*** MainTemplate.pm 22 Sep 2005 03:59:31 -0000 1.12
--- MainTemplate.pm 1 Feb 2006 22:02:38 -0000 1.13
***************
*** 46,60 ****
my $content = eval { $action->execute };
- if ( $@ ) {
- my $error = $@;
- $log->error( "Caught exception from action: $error" );
- $content = $error;
! # TODO: Set this error message from config file
! $self->add_content_param( title => 'Action execution error' );
}
# If an action set a file to send back, we're done
-
if ( my $send_file = CTX->response->send_file ) {
$log->is_info &&
--- 46,61 ----
my $content = eval { $action->execute };
! # If action died, check what to do depending on the error
! $content = $self->_action_error_content( $@ ) if $@;
!
! # If an action issued a redirect, we're done
! if ( CTX->response->is_redirect ) {
! $log->is_info &&
! $log->info( "Action specified a redirect" );
! return;
}
# If an action set a file to send back, we're done
if ( my $send_file = CTX->response->send_file ) {
$log->is_info &&
***************
*** 113,116 ****
--- 114,129 ----
}
+ sub _action_error_content {
+ my ($self, $error) = @_;
+ $log ||= get_logger( LOG_ACTION );
+
+ $log->error( "Caught exception from action: $error" );
+
+ # TODO: Set this error message from config file
+ $self->add_content_param( title => 'Action execution error' );
+
+ return $error;
+ }
+
########################################
# CONTENT PARAMS
|