Have `render()` die on exception, not return an exception object.
[catagits/Catalyst-View-TT.git] / t / lib / TestApp / Controller / Root.pm
index e119a1b..41a0d46 100644 (file)
@@ -34,9 +34,9 @@ sub test_includepath : Local {
 sub test_render : Local {
     my ($self, $c) = @_;
 
-    my $out = $c->stash->{message} = $c->view('TT::Appconfig')->render($c, $c->req->param('template'), {param => $c->req->param('param') || ''});
-    if (UNIVERSAL::isa($out, 'Template::Exception')) {
-        $c->response->body($out);
+    $c->stash->{message} = eval { $c->view('TT::Appconfig')->render($c, $c->req->param('template'), {param => $c->req->param('param') || ''}) };
+    if (my $err = $@) {
+        $c->response->body($err);
         $c->response->status(403);
     } else {
         $c->stash->{template} = 'test.tt';