X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FDBIx%2FClass%2FCDBICompat%2FHasMany.pm;h=3099bf65d50fccdce2c5dd989bd79895d637b0cb;hb=78bab9cad621ac5e3d1d12b02c41d662dec7a22a;hp=4bf34493041a37f0cced5755e6009bc0cdea0bd5;hpb=95a70f01eae4b2c325a3a527a72cf8ae91796e8c;p=dbsrgits%2FDBIx-Class-Historic.git diff --git a/lib/DBIx/Class/CDBICompat/HasMany.pm b/lib/DBIx/Class/CDBICompat/HasMany.pm index 4bf3449..3099bf6 100644 --- a/lib/DBIx/Class/CDBICompat/HasMany.pm +++ b/lib/DBIx/Class/CDBICompat/HasMany.pm @@ -14,7 +14,7 @@ sub has_many { if (!$self_key || $self_key eq 'id') { my ($pri, $too_many) = keys %{ $class->_primaries }; - die "has_many only works with a single primary key; ${class} has more" + $class->throw( "has_many only works with a single primary key; ${class} has more" ) if $too_many; $self_key = $pri; } @@ -35,9 +35,9 @@ sub has_many { $f_key = lc $1 if $f_class->_columns->{lc $1}; } - die "Unable to resolve foreign key for has_many from ${class} to ${f_class}" + $class->throw( "Unable to resolve foreign key for has_many from ${class} to ${f_class}" ) unless $f_key; - die "No such column ${f_key} on foreign class ${f_class}" + $class->throw( "No such column ${f_key} on foreign class ${f_class}" ) unless $f_class->_columns->{$f_key}; $class->add_relationship($rel, $f_class, { "foreign.${f_key}" => "self.${self_key}" },