handle the throw_exception bit. Drop DBIx::Class::Exception
[dbsrgits/DBIx-Class.git] / lib / DBIx / Class / Schema.pm
index bfc27cd..787a018 100644 (file)
@@ -3,12 +3,11 @@ package DBIx::Class::Schema;
 use strict;
 use warnings;
 
-use Carp qw/croak/;
+use Carp::Clan qw/^DBIx::Class/;
 use UNIVERSAL::require;
 
 use base qw/DBIx::Class/;
 
-__PACKAGE__->load_components(qw/Exception/);
 __PACKAGE__->mk_classdata('class_mappings' => {});
 __PACKAGE__->mk_classdata('source_registrations' => {});
 __PACKAGE__->mk_classdata('storage_type' => '::DBI');
@@ -116,7 +115,7 @@ sub source {
 
   # if we got here, they probably passed a full class name
   my $mapped = $self->class_mappings->{$moniker};
-  croak "Can't find source for ${moniker}"
+  $self->throw_exception("Can't find source for ${moniker}")
     unless $mapped && exists $sreg->{$mapped};
   return $sreg->{$mapped};
 }
@@ -185,7 +184,7 @@ sub load_classes {
     }
   } else {
     eval "require Module::Find;";
-    $class->throw("No arguments to load_classes and couldn't load".
+    $class->throw_exception("No arguments to load_classes and couldn't load".
       " Module::Find ($@)") if $@;
     my @comp = map { substr $_, length "${class}::"  } Module::Find::findallmod($class);
     $comps_for{$class} = \@comp;
@@ -344,6 +343,17 @@ sub clone {
   return $clone;
 }
 
+=item throw_exception
+
+Defaults to using Carp::Clan to report errors from user perspective.
+
+=cut
+
+sub throw_exception {
+  my ($self) = shift;
+  croak @_;
+}
+
 1;
 
 =head1 AUTHORS