aboutsummaryrefslogtreecommitdiffstats
path: root/lib/Reaction/InterfaceModel
diff options
context:
space:
mode:
authort0m <t0m@03d0b0b2-0e1a-0410-a411-fdb2f4bd65d7>2008-11-25 02:17:51 +0000
committert0m <t0m@03d0b0b2-0e1a-0410-a411-fdb2f4bd65d7>2008-11-25 02:17:51 +0000
commit09d2d18d3ee75780b3c7922bb0af004cf58b4be1 (patch)
tree94579bae8a0e4ba0f3b493c02c54422040fe7e12 /lib/Reaction/InterfaceModel
parentdb80cb74feca3ad9f372047624ccfcdfa8122ee4 (diff)
downloadreaction-09d2d18d3ee75780b3c7922bb0af004cf58b4be1.tar.gz
reaction-09d2d18d3ee75780b3c7922bb0af004cf58b4be1.zip
Tell the user that they're an idiot in more helpful ways
Diffstat (limited to 'lib/Reaction/InterfaceModel')
-rw-r--r--lib/Reaction/InterfaceModel/Reflector/DBIC.pm6
1 files changed, 5 insertions, 1 deletions
diff --git a/lib/Reaction/InterfaceModel/Reflector/DBIC.pm b/lib/Reaction/InterfaceModel/Reflector/DBIC.pm
index afa3dad..8ec01ab 100644
--- a/lib/Reaction/InterfaceModel/Reflector/DBIC.pm
+++ b/lib/Reaction/InterfaceModel/Reflector/DBIC.pm
@@ -650,6 +650,8 @@ sub parameters_for_source_object_attribute {
my $from_attr = $source_class->meta->find_attribute_by_name($attr_name);
my $reader = $from_attr->get_read_method;
+ die("Could not find reader for attribute '$attr_name' on $source_class")
+ unless $reader;
#default options. lazy build but no outsider method
my %attr_opts = ( is => 'ro', lazy => 1, required => 1,
@@ -731,7 +733,9 @@ sub parameters_for_source_object_attribute {
} else {
#no rel
$attr_opts{isa} = $from_attr->_isa_metadata;
- $attr_opts{default} = eval "sub{ shift->${dm_name}->${reader} }";
+ my $default_code = "sub{ shift->${dm_name}->${reader} }";
+ $attr_opts{default} = eval $default_code;
+ die "Could not generate default for attribute, code '$default_code' did not compile with: $@" if $@;
}
return \%attr_opts;
};