X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FMooseX%2FSingleton%2FMeta%2FMethod%2FConstructor.pm;h=e95e3185cf25d354b1e11c6dae94b3288147f8b4;hb=c87dffa8b2168446117323e2e4a9c9995bc40092;hp=520483afa14f35ff7bffc7dd64be3e68b889d9f1;hpb=0272982a342c6c778dba18094bd5e8c28cefc332;p=gitmo%2FMooseX-Singleton.git diff --git a/lib/MooseX/Singleton/Meta/Method/Constructor.pm b/lib/MooseX/Singleton/Meta/Method/Constructor.pm index 520483a..e95e318 100644 --- a/lib/MooseX/Singleton/Meta/Method/Constructor.pm +++ b/lib/MooseX/Singleton/Meta/Method/Constructor.pm @@ -64,11 +64,18 @@ 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; } +sub _expected_constructor_class { + return 'MooseX::Singleton::Object'; +} + no Moose; 1;