[Catalyst] Error handling

Steve Kleiman steve at prodhub.com
Mon Jan 18 17:05:18 GMT 2010


Thanks for all the feedback on how to log from within a schema. Log4perl is my hero.

I'm still looking for a way to capture runtime errors and ideally email them out in addition to logging to a file.

I've tried Catalyst-Action-RenderView-ErrorHandler but that seems to have no impact. I see the error on the console as usual but I don't get an email dispatched nor the expected error page. Maybe I've got it misconfigured? It seems like exactly what I want.

Same thing with Catalyst::Plugin::ErrorCatcher. Doesn't seem to catch runtime errors.

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.

Ideally the mechanism would trap ALL errors in controllers and also the schema.

I must be doing something wrong. Where am I off base?

Thanks in advance.

-steve kleiman


More information about the Catalyst mailing list