From: Shawn M Moore Date: Fri, 15 Jun 2012 18:58:27 +0000 (-0500) Subject: Some fixes for inlined errors X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=6d61e54c182a4ea4383f9148e084c6fb6b96763d;p=gitmo%2FMoose.git Some fixes for inlined errors --- diff --git a/lib/Moose/Meta/Attribute.pm b/lib/Moose/Meta/Attribute.pm index 9bea601..2350b3f 100644 --- a/lib/Moose/Meta/Attribute.pm +++ b/lib/Moose/Meta/Attribute.pm @@ -52,7 +52,7 @@ sub _inline_throw_error { return 'Moose::Util::throw(' . 'message => ' . $msg . ($args ? (', ' . $args) : '') - . ');'; + . ')'; } sub new { @@ -685,10 +685,10 @@ sub _inline_check_constraint { . 'do { local $_ = ' . $value . '; ' . $message . '->(' . $value . ')' . '}', - 'class => "Moose::Exception::TypeConstraint"', - 'attribute_name => ' . $self->name, - 'type_name => ' . $self->type_constraint->name, - 'value => ' . $value, + 'class => "Moose::Exception::TypeConstraint",' . + 'attribute_name => ' . $attr_name . ',' . + 'type_name => ' . $type_name . ',' . + 'value => ' . $value ) . ';', '}', ); @@ -702,10 +702,10 @@ sub _inline_check_constraint { . 'do { local $_ = ' . $value . '; ' . $message . '->(' . $value . ')' . '}', - 'class => "Moose::Exception::TypeConstraint"', - 'attribute_name => ' . $self->name, - 'type_name => ' . $self->type_constraint->name, - 'value => ' . $value, + 'class => "Moose::Exception::TypeConstraint",' . + 'attribute_name => ' . $attr_name . ',' . + 'type_name => ' . $type_name . ',' . + 'value => ' . $value ) . ';', '}', ); @@ -1252,15 +1252,15 @@ sub verify_against_type_constraint { $type_constraint->check($val) || $self->throw_error( - superclass => 'Moose::Exception::TypeConstraint', + class => 'Moose::Exception::TypeConstraint', message => "Attribute (" . $self->name . ") does not pass the type constraint because: " . $type_constraint->get_message($val), - value => $val, - attribute_name => $self->name, - type_name => $type_constraint->name, - @_); + value => $val, + attribute_name => $self->name, + type_name => $type_constraint->name, + @_); } package Moose::Meta::Attribute::Custom::Moose;