r49@latte: adam | 2006-12-03 12:30:40 -0800
[catagits/Catalyst-Action-REST.git] / lib / Catalyst / Action / Deserialize / YAML.pm
index aa6c411..84630f4 100644 (file)
@@ -16,14 +16,22 @@ use YAML::Syck;
 sub execute {
     my $self = shift;
     my ( $controller, $c, $test ) = @_;
+
     my $body = $c->request->body;
     if ($body) {
-        my $rdata = LoadFile($c->request->body);
+        my $rdata;
+        eval {
+            $rdata = LoadFile( $c->request->body );
+        };
+        if ($@) {
+            return $@;
+        }
         $c->request->data($rdata);
     } else {
-        $c->log->debug('I would have deserialized, but there was nothing in the body!');
+        $c->log->debug(
+            'I would have deserialized, but there was nothing in the body!');
     }
-};
+    return 1;
+}
 
 1;