I'm running under mod_perl, and when a user aborts an upload I get an error
in the log.

[error] Caught exception in engine "Apache2::RequestIO::read: (70014)
End of file found at /usr/local/share/perl/5.10.0/Catalyst/Engine/Apache.pm
line 187"

I don't see that it's possible, but is there any way to ignore some
exceptions (similar to how execute() can ignore a detach)? Not sure
there's a good case for it, other than to simply ignore the above. (I can
modify my log monitoring to ignore those, for example). But, there doesnt's
seen to be any way to get out of that block without generating an error

eval {
if ($class->debug) {
my $secs = time - $START || 1;
my $av = sprintf '%.3f', $COUNT / $secs;
my $time = localtime time;
$class->log->info("*** Request $COUNT ($av/s) [$$] [$time] ***");


my $c = $class->prepare(@arguments);
$status = $c->finalize;

if ( my $error = $@ ) {
chomp $error;
$class->log->error(qq/Caught exception in engine "$error"/);


Maybe I could override prepare() and return a different $c object with dummy
dispatch and finalize methods, but I suspect another prepare() and that
approach would break.

BTW -- I was looking at this along with the UploadProgress plugin. It does
this to catch aborted uploads.
The plugin is a bit old, but doesn't seem like overriding croak is a good
way to catch exceptions. Is there any reason not to wrap prepare_body in an
eval? Yep, I just tried and under mod_perl2 this doesn't catch aborted

my $croaked;

no warnings 'redefine';
local *Carp::croak = sub {
$croaked = shift;



if ( $croaked ) {
if ( my $id = $c->req->query_parameters->{progress_id} ) {
$c->log->info( "UploadProgress: User aborted upload $id" );

# Update progress to flag this so javascript will stop polling
my $progress = $c->cache->get( 'upload_progress_' . $id ) || {};

$progress->{aborted} = 1;

$c->cache->set( 'upload_progress_' . $id, $progress );

# rethrow the error
Catalyst::Exception->throw( $croaked );

Bill Moseley
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.scsys.co.uk/pipermail/catalyst/attachments/20091108/f2cbfd1c/attachment.htm

Search Discussions

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupcatalyst @
categoriescatalyst, perl
postedNov 9, '09 at 3:58a
activeNov 9, '09 at 3:58a

1 user in discussion

Bill Moseley: 1 post



site design / logo © 2022 Grokbase