Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: Catalyst: Users
Catalyst::View::Mason and Exception objects
 

Index | Next | Previous | View Flat


stephenclouse at gmail

Jul 2, 2009, 2:15 PM


Views: 350
Permalink
Catalyst::View::Mason and Exception objects

The following Mason template:

<%init>
die;
</%init>

results in a typical Catalyst error response.

This, on the other hand:

<%init>
DBIx::Class::Exception->throw('Foo');
</%init>

just gives a plain-text output, and the request is recorded as a success
($c->error is not set, finalize_error is not called, plugins like
ErrorCatcher are never triggered).

The issue seems to lie here:

174 if (blessed($output) && $output->isa('HTML::Mason::Exception')) {
175 chomp $output;
176 my $error = qq/Couldn't render component "$component_path" -
error was "$output"/;
177 $c->log->error($error);
178 $c->error($error);
179 return 0;
180 }

Since Mason does not wrap exception objects but simply re-throws them, the
exception object gets here and bypasses this.

More interesting is that this actually appears to be intentional behavior --
the View::Mason distro actually tests for it in t/exception.t. Any ideas on
why it's handled this way and how to make it DWIM?

--
Stephen Clouse <stephenclouse[at]gmail.com>

Subject User Time
Catalyst::View::Mason and Exception objects stephenclouse at gmail Jul 2, 2009, 2:15 PM

  Index | Next | Previous | View Flat
 
 


Interested in having your list archived? Contact lists@gossamer-threads.com
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.