X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=catagits%2FCatalyst-Runtime.git;a=blobdiff_plain;f=lib%2FCatalyst%2FRequest.pm;h=c4d7764d4e557aeca67f0684898a8d78550b05ec;hp=3bcc6c2591627e6b9e6e778d2f5f41aad7f38f97;hb=c63ec19d30f54b6fa44dff3e448108ab2e15ae84;hpb=b0ff1be8caade25b5485bf174f0224b2066a3b8f diff --git a/lib/Catalyst/Request.pm b/lib/Catalyst/Request.pm index 3bcc6c2..c4d7764 100644 --- a/lib/Catalyst/Request.pm +++ b/lib/Catalyst/Request.pm @@ -132,8 +132,11 @@ sub _build_body_data { my $fh = $self->body; local $_ = $fh; return $self->data_handlers->{$match}->($fh, $self); - } else { - Catalyst::Exception->throw("$content_type is does not have an available data handler"); + } else { + Catalyst::Exception->throw( + sprintf '%s does not have an available data handler. Valid data_handlers are %s.', + $content_type, join ', ', sort keys %{$self->data_handlers} + ); } } @@ -293,7 +296,10 @@ sub prepare_body { # Check for definedness as you could read '0' while ( defined ( my $chunk = $self->read() ) ) { $self->prepare_body_chunk($chunk); - $stream_buffer->print($chunk) if $stream_buffer; + next unless $stream_buffer; + + $stream_buffer->print($chunk) + || die sprintf "Failed to write %d bytes to psgi.input file: $!", length( $chunk ); } # Ok, we read the body. Lets play nice for any PSGI app down the pipe