[Dbix-class] DBIx::Class::Exceptions

Toby Corkindale toby at dryft.net
Thu Nov 8 01:43:51 GMT 2012


On 5 November 2012 20:19, Peter Rabbitson <rabbit+dbic at rabbit.us> wrote:
> On Fri, Nov 02, 2012 at 03:41:48PM +1100, Toby Corkindale wrote:
>> Hi,
>> It used to be the case (some versions ago) that if you died with an object
>> inside a txn_do() then the re-thrown error would still contain that object.
>>
>> However now it seems to be stringified on the way out.
>>
>> To give an example, I'm sure I used to be able to do this:
>>
>> try {
>>   $schema->txn_do(sub {
>>       die Custom::Exception->new(msg => "foobar");
>>   });
>> }
>> catch {
>>   $_->custom_exception_method;
>> };
>>
>> Is there any way to get back to that behaviour?
>
> This particular behavior is still there. I pushed a branch demonstrating
> it[1]. There are however improvements in the pipelines for this
> codepath. In any case - can you look at the branch in question and point
> out which part doesn't work as you expect?

Hi Peter,
I had to admit to being quite confused right now. I've been totally
failing to reproduce the issue now.
I rolled back the commit in my code, where I changed from txn_do() to
using txn_scope_guard(), and I'm still not seeing the problem. (Which
was that DBIx::Class was stringifying the object and prefixing it with
"DBIx::Class::txn_do error:" or similar.)

I specifically made that change to solve the problem I mentioned above
-- so I'm really confused as to why it has now disappeared. I haven't
upgraded any CPAN modules since then.

W.T.F.

-Toby

--
Turning and turning in the widening gyre
The falcon cannot hear the falconer
Things fall apart; the center cannot hold
Mere anarchy is loosed upon the world



More information about the DBIx-Class mailing list