X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FCatalyst%2FController%2FMessageDriven.pm;h=2c6c99725aa564932741ed07f23fd36460a298a4;hb=8f0f19f9d2dda14e3fe1b80cddaf076555b75734;hp=678e34bd676b91cb367875de8b6e744096a5bf98;hpb=03c90167fd57396abe0062240d6df97eded60124;p=catagits%2FCatalyst-Engine-STOMP.git diff --git a/lib/Catalyst/Controller/MessageDriven.pm b/lib/Catalyst/Controller/MessageDriven.pm index 678e34b..2c6c997 100644 --- a/lib/Catalyst/Controller/MessageDriven.pm +++ b/lib/Catalyst/Controller/MessageDriven.pm @@ -31,6 +31,20 @@ A Catalyst controller base class for use with Catalyst::Engine::Stomp, which handles YAML-serialized messages. A top-level "type" key in the YAML determines the action dispatched to. +=head1 METHODS + +=head2 begin + +Deserializes the request into C<< $c->stash->{request} >> + +=head2 default + +Dispatches to method named by the key C<< $c->stash->{request}->{type} >> + +=head2 end + +Serializes the response from C<< $c->stash->{response} >> + =cut __PACKAGE__->config( serializer => 'YAML' ); @@ -72,8 +86,9 @@ sub end : Private { # Custom error handler - steal errors from catalyst and dump them into # the stash, to get them serialized out as the reply. if (scalar @{$c->error}) { - my $error = join "\n", @{$c->error}; - $c->stash->{response} = { status => 'ERROR', error => $error }; + $c->log->error($_) for @{$c->error}; # Log errors in Catalyst + my $error = join "\n", @{$c->error}; + $c->stash->{response} = { status => 'ERROR', error => $error }; $output = $s->serialize( $c->stash->{response} ); $c->clear_errors; $c->response->status(400);