On Jun 7, 2010, at 10:57 PM, Jesse Luehrs wrote:

> On Mon, Jun 07, 2010 at 10:54:28PM -0500, Chris Fields wrote:
>> I'm seeing an odd error popping up with the latest Moose that's killing most 
>> of my tests.  I'm using a custom error metaclass and am seeing the following:
> 
> One of the changes in version 1.05 is that error metaclasses now have to
> inherit from Moose::Error::Default. That should probably have made it
> into Moose::Manual::Delta, sorry about that(:
> 
> -doy

Thanks doy.  Tried that and I got the same error unfortunately, but I did 
manage to get it to work by sticking in an explicit 
Class::MOP::load_class('Biome::Root::Error').  Notice I also explicitly load 
the meta class (Biome::Meta::Class) in the below, not doing so also causes 
errors (this is the Biome Moose-like sugar module):

package Biome;

our $VERSION = '0.001';

use Moose ();
use Moose::Exporter;

use Biome::Meta::Class;

my $EXCEPTION_CLASS = '';

if (exists $ENV{BP_EXCEPTION_CLASS}) {
        $EXCEPTION_CLASS = $ENV{BP_EXCEPTION_CLASS};
} else {
        eval {use Exception::Class; 1;};
        if (!$@) {
                $EXCEPTION_CLASS = 'Biome::Root::Error';
        Class::MOP::load_class('Biome::Root::Error');
        }
}

Moose::Exporter->setup_import_methods(also => 'Moose');

sub init_meta {
        shift;
        my $moose = Moose->init_meta(
                @_,
                base_class      => 'Biome::Root',
                metaclass       => 'Biome::Meta::Class',
                );
        $moose->error_class($EXCEPTION_CLASS);
        $moose;
}

1;



chris

Reply via email to