[Catalyst-commits] r9708 - Catalyst-Runtime/5.80/trunk/lib
t0m at dev.catalyst.perl.org
t0m at dev.catalyst.perl.org
Wed Apr 15 13:57:36 GMT 2009
Author: t0m
Date: 2009-04-15 14:57:36 +0100 (Wed, 15 Apr 2009)
New Revision: 9708
Modified:
Catalyst-Runtime/5.80/trunk/lib/Catalyst.pm
Log:
Clarify exception to finger the actual class which contains the dodgy COMPONENT method
Modified: Catalyst-Runtime/5.80/trunk/lib/Catalyst.pm
===================================================================
--- Catalyst-Runtime/5.80/trunk/lib/Catalyst.pm 2009-04-15 13:28:14 UTC (rev 9707)
+++ Catalyst-Runtime/5.80/trunk/lib/Catalyst.pm 2009-04-15 13:57:36 UTC (rev 9708)
@@ -2181,11 +2181,15 @@
);
}
- Catalyst::Exception->throw(
- message =>
- qq/Couldn't instantiate component "$component", "COMPONENT() didn't return an object-like value"/
- ) unless blessed($instance);
-
+ unless (blessed $instance) {
+ my $metaclass = Moose::Util::find_meta($component);
+ my $method_meta = $metaclass->find_method_by_name('COMPONENT');
+ my $component_method_from = $method_meta->associated_metaclass->name;
+ Catalyst::Exception->throw(
+ message =>
+ qq/Couldn't instantiate component "$component", COMPONENT() method (from $component_method_from) didn't return an object-like value./
+ );
+ }
return $instance;
}
More information about the Catalyst-commits
mailing list