Fixed exception logic due to not being able to use return with a catch{}
[dbsrgits/DBIx-Class.git] / lib / DBIx / Class / InflateColumn / DateTime.pm
index 9d8c61b..42b535e 100644 (file)
@@ -170,10 +170,13 @@ sub register_column {
 
             my ($dt, $err);
             try { $dt = $obj->_inflate_to_datetime( $value, \%info ) }
-            catch {;
-              return undef if ($undef_if_invalid);
-              $self->throw_exception ("Error while inflating ${value} for ${column} on ${self}: $_");
+            catch {
+              $err = 1;
+              if (! $undef_if_invalid) {
+               $self->throw_exception ("Error while inflating ${value} for ${column} on ${self}: $_");
+              }
             };
+            return undef if $err;
 
             return $obj->_post_inflate_datetime( $dt, \%info );
           },