Fix to columns_info_for for type(size)
[dbsrgits/DBIx-Class.git] / lib / DBIx / Class / Validation.pm
index 4b83067..b51c9c8 100644 (file)
@@ -4,10 +4,10 @@ use strict;
 use warnings;
 
 use base qw( DBIx::Class );
-use Carp qw( croak );
 use English qw( -no_match_vars );
 
-local $^W = 0; # Silence C:D:I redefined sub errors.
+#local $^W = 0; # Silence C:D:I redefined sub errors.
+# Switched to C::D::Accessor which doesn't do this. Hate hate hate hate.
 
 our $VERSION = '0.01';
 
@@ -20,8 +20,8 @@ sub validation_module {
     my $module = shift;
     
     eval("use $module");
-    croak("Unable to load the validation module '$module' because $EVAL_ERROR") if ($EVAL_ERROR);
-    croak("The '$module' module does not support the check method") if (!$module->can('check'));
+    $class->throw_exception("Unable to load the validation module '$module' because $EVAL_ERROR") if ($EVAL_ERROR);
+    $class->throw_exception("The '$module' module does not support the check method") if (!$module->can('check'));
     
     $class->_validation_module_accessor( $module );
 }
@@ -42,7 +42,7 @@ sub validate {
     my $profile = $self->validation_profile();
     my $result = $module->check( \%data => $profile );
     return $result if ($result->success());
-    croak( $result );
+    $self->throw_exception( $result );
 }
 
 sub insert {