Skip to content

Commit

Permalink
fix exception handling in perl < 5.14
Browse files Browse the repository at this point in the history
  • Loading branch information
dakkar committed Mar 28, 2012
1 parent 0548366 commit 900c104
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
6 changes: 5 additions & 1 deletion lib/Net/Stomp/Producer.pm
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -219,9 +219,13 @@ sub send {


try { $body = $self->serializer->($body) } try { $body = $self->serializer->($body) }
catch { catch {
local $@=$_; if (eval {$_[0]->isa('Net::Stomp::Producer::Exceptions::CantSerialize')}) {
die $_[0];
}
my $prev=$_[0];
Net::Stomp::Producer::Exceptions::CantSerialize->throw({ Net::Stomp::Producer::Exceptions::CantSerialize->throw({
message_body => $body, message_body => $body,
previous_exception => $prev,
}); });
}; };


Expand Down
1 change: 1 addition & 0 deletions lib/Net/Stomp/Producer/Exceptions.pm
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ use Data::Dump 'pp';
has message_body => ( is => 'ro', required => 1 ); has message_body => ( is => 'ro', required => 1 );
has message_headers => ( is => 'ro', required => 0 ); has message_headers => ( is => 'ro', required => 0 );
has reason => ( is => 'ro', default => q{sending the message didn't work} ); has reason => ( is => 'ro', default => q{sending the message didn't work} );
has '+previous_exception' => ( init_arg => 'previous_exception' );


sub as_string { sub as_string {
my ($self) = @_; my ($self) = @_;
Expand Down

0 comments on commit 900c104

Please sign in to comment.