Thanks for getting back, t0m.

By "abort all processing" it seemed like when the error was thrown, Catalyst 
stopped processing the request.

Here's my fabricated error in a controller:

> sub test_error : Local {
>       my ( $self, $c ) = @_;
>       Log::Log4perl->get_logger('General')->info('before error');
>       $c->nonexistent_method;
>       Log::Log4perl->get_logger('General')->info('after error');
>       $c->response->body('Got past error');
> }

Thanks to log4perl, I see the request seemingly hits 'end' before the error is 
registered (see console log below).

I also have a log line in 'finalize_error' but it never gets hit.

I tried putting '$c->clear_errors' in my 'end' method, but then the error 
doesn't print to console at all.

I'm missing something....

-steve


2010/01/18 17:33:16 Root.pm 100> auto 
2010/01/18 17:33:16 Administration.pm 55> before error 
2010/01/18 17:33:16 Root.pm 148> end 
[info] *** Request 2 (0.002/s) [5404] [Mon Jan 18 17:33:16 2010] ***
[debug] "GET" request for "app/project/administration/test_error" from 
"127.0.0.1"
[debug] Path is "app/project/administration/test_error"
[debug] Found sessionid "a6868e20c5ff9800b88e1a6ac7eef75ec4e9a8c4" in cookie
[debug] Restored session "a6868e20c5ff9800b88e1a6ac7eef75ec4e9a8c4"
[debug] running ACL rule CODE(0x1027c0438) defined at 
/Users/smk/enola/ProdHub/tech/prodhub/prodhub/script/../lib/Prodhub.pm line 307 
on app/project/administration/test_error
[debug] Access to app/project/administration/test_error allowed by rule 
CODE(0x1027c0438) (defined at 
/Users/smk/enola/ProdHub/tech/prodhub/prodhub/script/../lib/Prodhub.pm line 307)
[error] Caught exception in 
Prodhub::Controller::App::Project::Administration->test_error "Can't locate 
object method "nonexistent_method" via package "Prodhub" at 
/Users/smk/enola/ProdHub/tech/prodhub/prodhub/script/../lib/Prodhub/Controller/App/Project/Administration.pm
 line 56."
[error] Caught exception in engine "Can't use string 
("a6868e20c5ff9800b88e1a6ac7eef75e") as a HASH ref while "strict refs" in use 
at /usr/local/lib/perl5/site_perl/5.10.1/Catalyst/Engine.pm line 117."


On Jan 18, 2010, at 9:22 AM, Tomas Doran wrote:

> Steve Kleiman wrote:
>> Found a post on this mailing list suggesting:
>> sub finalize_error {
>>  my ($c) = @_; # Note, not ($self, $c)
>>  if ( @{$c->errors} ) {
>>    $c->stash->template('error.tt');
>>    # You might also need to forward to the view here yourself
>>    return;
>>  }
>>  $c->NEXT::finalize_error();
>> }
>> But the error seems to abort all processing and never make it to this point.
> 
> I don't see why that's happening - can you explain what you mean by 'abort 
> all processing'?
> 
> The most common reason for custom error handlers not working is that people 
> forget to call $c->clear_error...
> 
> Cheers
> t0m


_______________________________________________
List: [email protected]
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/[email protected]/
Dev site: http://dev.catalyst.perl.org/

Reply via email to