From: Shawn M Moore <sartak@gmail.com>
Date: Fri, 27 Jun 2008 04:14:09 +0000 (+0000)
Subject: Better error message for Foo->meta->clone_instance(not an instance of Foo)
X-Git-Tag: 0_64~9
X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=f3e2012935ea96dc1846cb9ba577cb6931bf43fb;p=gitmo%2FClass-MOP.git

Better error message for Foo->meta->clone_instance(not an instance of Foo)
---

diff --git a/lib/Class/MOP/Class.pm b/lib/Class/MOP/Class.pm
index dc7042c..050189b 100644
--- a/lib/Class/MOP/Class.pm
+++ b/lib/Class/MOP/Class.pm
@@ -407,7 +407,8 @@ sub clone_object {
     my $class    = shift;
     my $instance = shift;
     (blessed($instance) && $instance->isa($class->name))
-        || confess "You must pass an instance ($instance) of the metaclass (" . $class->name . ")";
+        || confess "You must pass an instance of the metaclass (" . $class->name . "), not ($instance)";
+
     # NOTE:
     # we need to protect the integrity of the
     # Class::MOP::Class singletons here, they