Skip Menu |

This queue is for tickets about the Moo CPAN distribution.

Report information
The Basics
Id: 79596
Status: resolved
Priority: 0/
Queue: Moo

People
Owner: ilmari+cpan [...] ilmari.org
Requestors: djerius [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)



Subject: isa failure text doesn't use the value of init_arg to identify the attribute
The isa check uses the attribute name specified as the second argument to has when generating an error message instead of the name specified by init_arg.  This can confuse the caller as typically  the name specified by init_arg is the one which is documented.

For example:

$ { package Foo; use Moo; has x => ( is => 'rw', init_arg => 'y', isa => sub { die( "invalid\n" ); } ) }
$ Foo->new( y => 1 )                                                                                   
Runtime error: isa check for "x" failed: invalid
 

I've improved the message for constructor arguments to include both the attribute name and the argument name when an error occurs during construction: isa check for "foo" (constructor argument: "bar") failed: The work is currently on the fix-init_arg-name-rt79596 branch in git://git.shadowcat.co.uk/gitmo/Moo.git
Fixed in version 1.000005, just uploaded to CPAN