From: Dave Rolsky Date: Thu, 18 Sep 2008 15:11:20 +0000 (+0000) Subject: Incorporate the throw_error bits from Moose turnk X-Git-Tag: 0.12~1 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=8a137905bf4b3fe7ad7bd47b16fa6d87593ab6a0;p=gitmo%2FMooseX-Singleton.git Incorporate the throw_error bits from Moose turnk --- diff --git a/lib/MooseX/Singleton/Meta/Method/Constructor.pm b/lib/MooseX/Singleton/Meta/Method/Constructor.pm index 520483a..6e83444 100644 --- a/lib/MooseX/Singleton/Meta/Method/Constructor.pm +++ b/lib/MooseX/Singleton/Meta/Method/Constructor.pm @@ -64,7 +64,10 @@ sub initialize_body { } @type_constraints; $code = eval $source; - confess "Could not eval the constructor :\n\n$source\n\nbecause :\n\n$@" if $@; + $self->throw_error( + "Could not eval the constructor :\n\n$source\n\nbecause :\n\n$@", + error => $@, data => $source ) + if $@; } $self->{'body'} = $code; }