Skip Menu |

This queue is for tickets about the Moose CPAN distribution.

Report information
The Basics
Id: 96310
Status: rejected
Priority: 0/
Queue: Moose

People
Owner: Nobody in particular
Requestors: xenoterracide [...] gmail.com
Cc:
AdminCc:

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



Subject: Moose::Exception subclassing bug
Date: Sat, 7 Jun 2014 11:48:36 -0500
To: bugs-moose [...] rt.cpan.org
From: Caleb Cushing <xenoterracide [...] gmail.com>
Can't call method "as_string" on an undefined value at /home/xenoterracide/perl5/perlbrew/perls/perl-5.18.2/lib/site_perl/5.18.2/x86_64-linux/Moose/Exception.pm I extended Moose::Exception and was overriding trace, this was unintentional on my part, bu if you look at Moose::Exception you'll fine that the overload stringification, calls $self->trace->as_string, it should instead check to see if trace is defined, in the event that a subclasser does this. At the discretion of the fixer how it handles undefined, though I would suggest an exception of some sort. -- Caleb Cushing http://xenoterracide.com Calendar: https://www.google.com/calendar/embed?src=xenoterracide%40gmail.com&ctz=America/Chicago
On 2014-06-07 09:48:45, XENO wrote: Show quoted text
> Can't call method "as_string" on an undefined value at > /home/xenoterracide/perl5/perlbrew/perls/perl- > 5.18.2/lib/site_perl/5.18.2/x86_64-linux/Moose/Exception.pm
Given that the 'trace' method comes from an attribute, declared thusly: has 'trace' => ( is => 'ro', isa => 'Devel::StackTrace', ... ); trace could ever become undefined. Even if something else was altering how 'trace' behaves, the original contract of "trace must always return something defined" ought to be honoured. Show quoted text
> I extended Moose::Exception and was overriding trace, this was > unintentional on my part, bu if you look at Moose::Exception you'll > fine that the overload stringification, calls $self->trace->as_string, > it should instead check to see if trace is defined, in the event that > a subclasser does this. At the discretion of the fixer how it handles > undefined, though I would suggest an exception of some sort.
Well, it did throw an exception, just not an objectified one :) Since the prospect of subclassing Moose::Exception has been shown elsewhere to be dubious, I'm closing this ticket.
On 2014-06-11 15:34:25, ETHER wrote: Show quoted text
> trace could ever become undefined.
Sorry, typo: ... trace SHOULD NEVER become undefined.