X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FDBIx%2FClass%2FSchema.pm;h=787a018646359e91bb672693fee2ef8d04ffc357;hb=701da8c4d6f0b78ffc015085aa410a6cacfcdb40;hp=bfc27cd9c6c7fb7fe8df75335cdddaf18d5cdd85;hpb=39e54ad026643adc23699f2e187c0e71ec4b6532;p=dbsrgits%2FDBIx-Class.git diff --git a/lib/DBIx/Class/Schema.pm b/lib/DBIx/Class/Schema.pm index bfc27cd..787a018 100644 --- a/lib/DBIx/Class/Schema.pm +++ b/lib/DBIx/Class/Schema.pm @@ -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