On Thu, Oct 11, 2012 at 5:38 AM, Robert Rothenberg <[email protected]> wrote:

>
> I would like to trap every error added to $c->error() and log it, noting
> the
> caller (filename, line number) in the logs.
>
> I've not gotten Catalyst::Plugin::ErrorCatcher to work, so I wrote my own
> plugin that overrides $c->error with the following method:
>
>   use MRO::Compat;
>   use namespace::autoclean;
>
>   sub error {
>     my ($c, @args) = @_;
>
>     foreach my $arg (@args) {
>         if ($arg) {
>
>             $c->log->error($arg);
>         }
>     }
>

Isn't that what finalize already does?

I have a very old and out-dated plugin I use that wraps execute() and sets
__DIE__ and __WARN__ to catch those and uses Devel::StackTrace to add in a
stack trace.   Then I use log4perl to format and direct the messages.

I also use Moose's Throwable which includes a stack trace.


-- 
Bill Moseley
[email protected]
_______________________________________________
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