Hello Moose herders! Karen wrote in http://www.nntp.perl.org/group/perl.moose/2014/01/msg2796.html:
> Also, I'd like us to restore the previous 'error_class' mechanism
> for indicating in your own Moose-based objects how errors should be
> delivered. It wasn't a well-used feature, but we accidentally lost
> it in the 2.1200 release, and some code on the cpan does use it, so
> it will be nice to bring that back before its absence is noticed.
Turns out that we just noticed that absenceā¦
We have code that wraps exceptions (in our case, coming from
``MooseX::Constructor::AllErrors``) in an exception class of our own,
then catches that.
With a recent update of the ``::AllErrors`` distribution, our code
started failing, because it now calls ``die`` instead of
``meta->throw_error``, so even if we're still using an older
``Moose``, the custom error class is not used.
So now I have a few problems:
- I have to handle exceptions coming from inside ``Moose`` as well as
those coming from various ``MooseX::*`` (and these do not
necessarily inherit from ``Moose::Exception``)
- I can't keep my wrapping logic (which extracts some useful pieces
from the various exceptions) hidden away in a single place, but I
have to call it from each exception handler
Not *hard* problems, mind you, just a bit annoying. I think I'll end
up with something like::
try { whatever() }
catch {
my $wrapped = wrap_exception($_);
if ($wrapped) { whatever_was_there_already }
else { die $_ }
};
My main issue is that I can't find any mention of the removal of
``error_class`` in any changelog or delta documentā¦
Anyway, suggestions on how to make the above code better are welcome,
and I volunteer to help re-design / re-implement the removed feature.
--
Dakkar - <Mobilis in mobile>
GPG public key fingerprint = A071 E618 DD2C 5901 9574
6FE2 40EA 9883 7519 3F88
key id = 0x75193F88
One does not thank logic.
-- Sarek, "Journey to Babel", stardate 3842.4
signature.asc
Description: PGP signature
