[Catalyst] Catching Exceptions

Mark Blythe list at markblythe.com
Mon Apr 3 15:27:23 CEST 2006


Thanks Sebastian.

Using eval is actually the first thing I tried, as shown in that code example:

sub foo1 : Local {
  my ($self, $c) = @_;

  eval {
     $c->forward('foo2');
  };

  if (my $e = MyApp::Exception::Special->caught()) {
     ... some special recovery code ...
  }
}

This didn't work for me.  $@ came back empty after the forward()
(within the eval) even though foo2 threw an exception.

Did you have a different eval scenario in mind?

I'll experiement with an end sub to see if that works for my situation.

Thanks,
Mark

On 4/3/06, Sebastian Riedel <sri at oook.de> wrote:
>
> 03.04.2006 08:07 Mark Blythe:
>
> > Oops, I forgot to include an important line from my current solution.
> > After my "special recovery code", I'm having to do $c->error(0) to
> > clear the Catalyst errors and avoid the exception page.
>
> Catch them in your end action or use eval.
>
>
> --
> sebastian
>
>
> _______________________________________________
> Catalyst mailing list
> Catalyst at lists.rawmode.org
> http://lists.rawmode.org/mailman/listinfo/catalyst
>



More information about the Catalyst mailing list