From: Dave Rolsky Date: Wed, 8 Sep 2010 02:01:00 +0000 (-0500) Subject: Improve message when there is an attribute conflict when composing one role into... X-Git-Tag: 1.13~23 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=51d4595e129626dcbc28a9ca7338242afbfd0541;p=gitmo%2FMoose.git Improve message when there is an attribute conflict when composing one role into another --- diff --git a/lib/Moose/Meta/Role/Application/ToRole.pm b/lib/Moose/Meta/Role/Application/ToRole.pm index db760aa..7f8425e 100644 --- a/lib/Moose/Meta/Role/Application/ToRole.pm +++ b/lib/Moose/Meta/Role/Application/ToRole.pm @@ -57,9 +57,15 @@ sub apply_attributes { # make sure we haven't seen this one already too $role2->get_attribute($attribute_name) != $role1->get_attribute($attribute_name)) { + my $role2_name = $role2->name; + require Moose; - Moose->throw_error("Role '" . $role1->name . "' has encountered an attribute conflict " . - "during composition. This is fatal error and cannot be disambiguated."); + Moose->throw_error( "Role '" + . $role1->name + . "' has encountered an attribute conflict" + . " while being composed into '$role2_name'." + . " This is a fatal error and cannot be disambiguated." + . " The conflicting attribute is named '$attribute_name'." ); } else { $role2->add_attribute(