On Tue Jan 31 22:26:10 2017, TOBYINK wrote:
Show quoted text> Could you be more specific? Provide example code, show current
> behaviour, and desired behaviour?
>
> Note that Type::Tiny throws exception objects rather than just dying
> with a string. If you've got Devel::StackTrace installed, these will
> include a stack trace.
Ok, consider this example:
package Foo {
use Moo;
use Types::Standard ':all';
has attr1 => is => 'rw', isa => Int;
};
Foo->new(attr1 => "String);
When you run that, the output is currently:
Value "String" did not pass type constraint "Int" (in $args->{"attr1"}) at (eval 76) line 51
"Int" is a subtype of "Num"
"Num" is a subtype of "LaxNum"
Value "String" did not pass type constraint "LaxNum" (in $args->{"attr1"})
"LaxNum" is defined as: (defined($_) && !ref($_) && Scalar::Util::looks_like_number($_))
I expect it to say "at foo.pl line 6" instead of "at (eval 76) line 51". I did just install Devel::StackTrace and the output was unchanged.
While carp is a primitive tool, it is a tool that works, and is pretty standard for writing modules. It would be nice if the exception object you are using could match carp behavior.