[Catalyst-commits] r11716 - Catalyst-View-Petal/branches/render/lib/Catalyst/View

hobbs at dev.catalyst.perl.org hobbs at dev.catalyst.perl.org
Tue Nov 3 00:19:02 GMT 2009


Author: hobbs
Date: 2009-11-03 00:19:01 +0000 (Tue, 03 Nov 2009)
New Revision: 11716

Removed:
   Catalyst-View-Petal/branches/render/lib/Catalyst/View/Petal/
Modified:
   Catalyst-View-Petal/branches/render/lib/Catalyst/View/Petal.pm
Log:
Turns out that render() should actually be allowed to die.

Change that around and remove the now-totally-useless exception class.


Modified: Catalyst-View-Petal/branches/render/lib/Catalyst/View/Petal.pm
===================================================================
--- Catalyst-View-Petal/branches/render/lib/Catalyst/View/Petal.pm	2009-11-03 00:18:48 UTC (rev 11715)
+++ Catalyst-View-Petal/branches/render/lib/Catalyst/View/Petal.pm	2009-11-03 00:19:01 UTC (rev 11716)
@@ -64,11 +64,13 @@
         return 0;
     }
 
-    my $output = $self->render($c, $file);
 
-    if (UNIVERSAL::isa($output, 'Catalyst::View::Petal::Exception')) {
-      my $error = qq/Couldn't render template "/ . $output->template 
-          . qq/". Error: "/ . $output->message . qq/"/;
+    my $output = eval { 
+      $self->render($c, $file);
+    };
+
+    if ($@) {
+      my $error = qq/Couldn't render template "$file". Error: "$@"/;
       $c->log->error($error);
       $c->error($error);
       return 0;
@@ -118,16 +120,7 @@
 
   my $petal = Petal->new( %options, %{ $self->config } );
 
-  my $body = eval { $petal->process($process) };
-
-  # Try to make this work kind of like View::TT does -- on error return
-  # a trapped exception. Except Petal doesn't have an exception class...
-  if ( my $error = $@ ) {
-    chomp $error;
-    return Catalyst::View::Petal::Exception->new(message => $error, template => $template);
-  } else {
-    return $body;
-  }
+  return $petal->process($process);
 }
 
 =item config
@@ -145,6 +138,8 @@
 
 Christian Hansen, C<ch at ngmedia.com>
 
+Andrew Rodland C<arodland at cpan.org>
+
 =head1 COPYRIGHT
 
 This program is free software, you can redistribute it and/or modify it




More information about the Catalyst-commits mailing list