X-Git-Url: https://git.decadent.org.uk/gitweb/?a=blobdiff_plain;ds=sidebyside;f=lib%2FMaypole.pm;h=119a85a29127c9908581bfa6afb34b667d0bd5c9;hb=57a9b9bffae05c0925b0bbaa9a595ecb96d45beb;hp=dbae33be3580d65f667d6e79044ef9b30ca94634;hpb=12d8a77a713d5ed4f08414e5f34e96d45f60e2d3;p=maypole.git diff --git a/lib/Maypole.pm b/lib/Maypole.pm index dbae33b..119a85a 100644 --- a/lib/Maypole.pm +++ b/lib/Maypole.pm @@ -443,16 +443,11 @@ sub handler : method $self->get_user; my $status = $self->handler_guts; - - # moving this here causes unit test failures - need to check why - # before committing the move - #$status = $self->__call_process_view unless $self->output; - return $status unless $status == OK; # TODO: require send_output to return a status code $self->send_output; - + return $status; } @@ -515,7 +510,7 @@ sub handler_guts if ( my $error = $@ ) { - $status = $self->call_exception($error); + $status = $self->call_exception($error, "authentication"); if ( $status != OK ) { @@ -542,7 +537,7 @@ sub handler_guts if ( my $error = $@ ) { - $status = $self->call_exception($error); + $status = $self->call_exception($error, "model"); if ( $status != OK ) { @@ -595,7 +590,7 @@ sub __call_process_view if ( my $error = $@ ) { - $status = $self->call_exception($error); + $status = $self->call_exception($error, "view"); if ( $status != OK ) { @@ -823,16 +818,16 @@ exception method of your Maypole application. sub call_exception { - my ($self, $error) = @_; + my ($self, $error, $when) = @_; # Check if we have a model class with an exception() to delegate to if ( $self->model_class && $self->model_class->can('exception') ) { - my $status = $self->model_class->exception( $self, $error ); + my $status = $self->model_class->exception( $self, $error, $when ); return $status if $status == OK; } - return $self->exception($error); + return $self->exception($error, $when); } @@ -845,7 +840,14 @@ processed. =cut -sub exception { return ERROR } +sub exception { + my ($self, $error, $when) = @_; + if ($self->view_object->can("report_error") and $self->debug) { + $self->view_object->report_error($self, $error, $when); + return OK; + } + return ERROR; +} =item additional_data