summaryrefslogtreecommitdiff
path: root/lib/Moose/Exception/AttributeValueIsNotAnObject.pm
diff options
context:
space:
mode:
Diffstat (limited to 'lib/Moose/Exception/AttributeValueIsNotAnObject.pm')
-rw-r--r--lib/Moose/Exception/AttributeValueIsNotAnObject.pm27
1 files changed, 27 insertions, 0 deletions
diff --git a/lib/Moose/Exception/AttributeValueIsNotAnObject.pm b/lib/Moose/Exception/AttributeValueIsNotAnObject.pm
new file mode 100644
index 0000000..523a4a9
--- /dev/null
+++ b/lib/Moose/Exception/AttributeValueIsNotAnObject.pm
@@ -0,0 +1,27 @@
+package Moose::Exception::AttributeValueIsNotAnObject;
+our $VERSION = '2.1405';
+
+use Moose;
+extends 'Moose::Exception';
+with 'Moose::Exception::Role::Instance', 'Moose::Exception::Role::Attribute';
+
+has 'method' => (
+ is => 'ro',
+ isa => 'Moose::Meta::Method::Delegation',
+ required => 1,
+);
+
+has 'given_value' => (
+ is => 'ro',
+ isa => 'Any',
+ required => 1,
+);
+
+sub _build_message {
+ my $self = shift;
+ "Cannot delegate ".$self->method->name." to "
+ .$self->method->delegate_to_method." because the value of "
+ . $self->attribute->name . " is not an object (got '".$self->given_value."')";
+}
+
+1;