Skip to content

Commit 4f52479

Browse files
committed
Fix endless loop on BareSourcelessResultClass->throw_exception(...)
There is a better fix for this in the pipes, but this will do for now
1 parent b4ba514 commit 4f52479

File tree

4 files changed

+22
-2
lines changed

4 files changed

+22
-2
lines changed

Changes

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ Revision history for DBIx::Class
33
* Fixes
44
- Fix incorrect collapsing-parser source being generated in the
55
presence of unicode data among the collapse-points
6+
- Fix endless loop on BareSourcelessResultClass->throw_exception(...)
67

78
* Misc
89
- Depend on newer Moo, fixing some interoperability issues:

lib/DBIx/Class/Row.pm

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1564,8 +1564,8 @@ See L<DBIx::Class::Schema/throw_exception>.
15641564
sub throw_exception {
15651565
my $self=shift;
15661566

1567-
if (ref $self && ref $self->result_source ) {
1568-
$self->result_source->throw_exception(@_)
1567+
if (ref $self && ref (my $rsrc = try { $self->result_source_instance } ) ) {
1568+
$rsrc->throw_exception(@_)
15691569
}
15701570
else {
15711571
DBIx::Class::Exception->throw(@_);

t/60core.t

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -636,4 +636,6 @@ SKIP: {
636636

637637
throws_ok { $schema->resultset} qr/resultset\(\) expects a source name/, 'resultset with no argument throws exception';
638638

639+
throws_ok { $schema->source('Artist')->result_class->new( 'bugger' ) } qr/must be a hashref/;
640+
639641
done_testing;
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
use strict;
2+
use warnings;
3+
4+
use Test::More;
5+
use Test::Exception;
6+
7+
use lib 't/lib';
8+
use DBICTest;
9+
10+
{
11+
package DBICTest::Foo;
12+
use base "DBIx::Class::Core";
13+
}
14+
15+
throws_ok { DBICTest::Foo->new("urgh") } qr/must be a hashref/;
16+
17+
done_testing;

0 commit comments

Comments
 (0)