From: Matt S Trout Date: Sat, 26 Nov 2011 19:58:37 +0000 (+0000) Subject: trap param error instead of crashing X-Git-Tag: v0.001002~12 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=scpubgit%2FTak.git;a=commitdiff_plain;h=b8d6fce44d99e86b2b116f00c3752ef340950402 trap param error instead of crashing --- diff --git a/lib/Tak/ConnectionReceiver.pm b/lib/Tak/ConnectionReceiver.pm index d85b1b4..9a06dd1 100644 --- a/lib/Tak/ConnectionReceiver.pm +++ b/lib/Tak/ConnectionReceiver.pm @@ -36,6 +36,10 @@ sub DEMOLISH { sub receive_request { my ($self, $tag, $meta, @payload) = @_; my $channel = $self->channel; + unless (ref($meta) eq 'HASH') { + $channel->write_message(mistake => $tag => 'meta value not a hashref'); + return; + } my $req = Tak::Request->new( ($meta->{progress} ? (on_progress => sub { $channel->write_message(progress => $tag => @_) })