From: Dave Rolsky Date: Tue, 30 Jun 2009 04:05:03 +0000 (-0500) Subject: Improve error message for metaclass incompat errors X-Git-Tag: 0.89~23 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=4c95b59101a91be708645bb4ab00662ebc92f664;p=gitmo%2FClass-MOP.git Improve error message for metaclass incompat errors --- diff --git a/lib/Class/MOP/Class.pm b/lib/Class/MOP/Class.pm index f4c8a4e..0e24de4 100644 --- a/lib/Class/MOP/Class.pm +++ b/lib/Class/MOP/Class.pm @@ -197,17 +197,17 @@ sub _check_metaclass_compatibility { : ref($super_meta); ($self->isa($super_meta_type)) - || confess "Class::MOP::class_of(" . $self->name . ") => (" + || confess "The metaclass of " . $self->name . " (" . (ref($self)) . ")" . " is not compatible with the " . - "Class::MOP::class_of(".$superclass_name . ") => (" + "metaclass of its superclass, ".$superclass_name . " (" . ($super_meta_type) . ")"; # NOTE: # we also need to check that instance metaclasses # are compatibile in the same the class. ($self->instance_metaclass->isa($super_meta->instance_metaclass)) - || confess "Class::MOP::class_of(" . $self->name . ")->instance_metaclass => (" . ($self->instance_metaclass) . ")" . + || confess "The instance metaclass for " . $self->name . " (" . ($self->instance_metaclass) . ")" . " is not compatible with the " . - "Class::MOP::class_of(" . $superclass_name . ")->instance_metaclass => (" . ($super_meta->instance_metaclass) . ")"; + "instance metaclass of its superclass, " . $superclass_name . " (" . ($super_meta->instance_metaclass) . ")"; } }