No need for default to be a sub when it just returns a string.
[gitmo/Moose.git] / lib / Moose / Meta / Class.pm
index db69521..4d07d55 100644 (file)
@@ -28,12 +28,12 @@ __PACKAGE__->meta->add_attribute('roles' => (
 
 __PACKAGE__->meta->add_attribute('constructor_class' => (
     accessor => 'constructor_class',
-    default  => sub { 'Moose::Meta::Method::Constructor' }
+    default  => 'Moose::Meta::Method::Constructor',
 ));
 
 __PACKAGE__->meta->add_attribute('destructor_class' => (
     accessor => 'destructor_class',
-    default  => sub { 'Moose::Meta::Method::Destructor' }
+    default  => 'Moose::Meta::Method::Destructor',
 ));
 
 __PACKAGE__->meta->add_attribute('error_class' => (
@@ -653,8 +653,6 @@ sub make_immutable {
       );
 }
 
-#{ package Moose::Meta::Class::ErrorRoutines; %Carp::Internal?
-
 our $error_level;
 
 sub throw_error {
@@ -679,12 +677,14 @@ sub create_error {
         unshift @args, "message";
     }
 
-    my %args = ( metaclass => $self, error => $@, @args );
+    my %args = ( metaclass => $self, last_error => $@, @args );
 
     $args{depth} += $error_level;
 
     my $class = ref $self ? $self->error_class : "Moose::Error::Default";
 
+    Class::MOP::load_class($class);
+
     $class->new(
         Carp::caller_info($args{depth}),
         %args