From: Jesse Luehrs Date: Thu, 21 Apr 2011 05:39:35 +0000 (-0500) Subject: confess here, since this should never happen X-Git-Tag: 2.0100~60 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=4e8d7b8cc129d55db4e02b2d349e248adb277450;p=gitmo%2FMoose.git confess here, since this should never happen --- diff --git a/lib/Moose/Meta/TypeConstraint/Parameterizable.pm b/lib/Moose/Meta/TypeConstraint/Parameterizable.pm index 515a952..584b909 100644 --- a/lib/Moose/Meta/TypeConstraint/Parameterizable.pm +++ b/lib/Moose/Meta/TypeConstraint/Parameterizable.pm @@ -8,6 +8,8 @@ use base 'Moose::Meta::TypeConstraint'; use Moose::Meta::TypeConstraint::Parameterized; use Moose::Util::TypeConstraints (); +use Carp 'confess'; + __PACKAGE__->meta->add_attribute('constraint_generator' => ( accessor => 'constraint_generator', predicate => 'has_constraint_generator', @@ -46,7 +48,9 @@ sub _can_coerce_constraint_from { sub generate_inline_for { my ($self, $type, $val) = @_; - return unless $self->has_inline_generator; + confess "Can't generate an inline constraint for $type, since none " + . "was defined" + unless $self->has_inline_generator; return $self->inline_generator->( $self, $type, $val ); }