From: Lars Dɪᴇᴄᴋᴏᴡ 迪拉斯 Date: Mon, 7 Dec 2009 17:39:04 +0000 (+0100) Subject: expand Class/Role clash error message X-Git-Tag: 0.93_01~51 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=677eafe2428997f9488ede46cef911c0220d3b3f;p=gitmo%2FMoose.git expand Class/Role clash error message * distinction on Moose::Meta::Class as per doy --- diff --git a/lib/Moose.pm b/lib/Moose.pm index 6c9f6c7..315d6d8 100644 --- a/lib/Moose.pm +++ b/lib/Moose.pm @@ -159,7 +159,12 @@ sub init_meta { if ( $meta = Class::MOP::get_metaclass_by_name($class) ) { unless ( $meta->isa("Moose::Meta::Class") ) { - Moose->throw_error("$class already has a metaclass, but it does not inherit $metaclass ($meta)"); + my $error_message = "$class already has a metaclass, but it does not inherit $metaclass ($meta)."; + if ( $meta->isa('Moose::Meta::Role') ) { + Moose->throw_error($error_message . ' You cannot make the same thing a role and a class. Remove either Moose or Moose::Role.'); + } else { + Moose->throw_error($error_message); + } } } else { # no metaclass, no 'meta' method