On Jun 8, 2010, at 12:07 AM, Chris Fields wrote:
> 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):
Spoke too soon! Now I'm seeing a brand new problem. My custom base class uses
Moose directly (not my Biome sugar class) to avoid recursive inheritance. This
gives the base class a default error metaclass of Moose::Error::Default. If I
do something like the following bit of code, it fails indicating the error
metaclass doesn't match:
# Tried to use 'Biome::Tools::IUPAC'.
# Error: The error metaclass for Biome::Tools::IUPAC (Biome::Root::Error)
is not compatible with the error metaclass of its superclass, Biome::Root
(Moose::Error::Default) at
/opt/perl512/lib/site_perl/5.12.1/darwin-thread-multi-2level/Class/MOP/Class.pm
line 277
--------------------------
package Biome::Tools::IUPAC;
use Biome;
no Biome;
1;
--------------------------
Oddly enough, if the above also consumes a role it appears to work just fine.
I would assume one way to work around this is to add the error metaclass
explicitly in the base class:
__PACKAGE__->meta->error_class('Biome::Root::Exception')
but attempting to do so doesn't work, either; in fact, the error oddly inverts:
# Tried to use 'Biome::Tools::IUPAC'.
# Error: The error metaclass for Biome::Tools::IUPAC
(Moose::Error::Default) is not compatible with the error metaclass of its
superclass, Biome::Root (Biome::Root::Error) at
/opt/perl512/lib/site_perl/5.12.1/darwin-thread-multi-2level/Class/MOP/Class.pm
line 277
Any ideas? Again, just turning off custom error classes works, but it would be
nice to have this working.
chris