From: Michael Reddick Date: Mon, 10 Aug 2009 20:40:33 +0000 (+0000) Subject: Added exception when resultset called without an argument X-Git-Tag: v0.08109~23 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=73d47f9f2e278359b095b9986da89988aee83a44;p=dbsrgits%2FDBIx-Class.git Added exception when resultset called without an argument --- diff --git a/Changes b/Changes index a561748..5918ec2 100644 --- a/Changes +++ b/Changes @@ -38,6 +38,7 @@ Revision history for DBIx::Class the server on every invocation unlike dbh() - Some fixes of multi-create corner cases - Multiple POD improvements + - Added exception when resultset is called without an argument 0.08108 2009-07-05 23:15:00 (UTC) - Fixed the has_many prefetch with limit/group deficiency - diff --git a/lib/DBIx/Class/Schema.pm b/lib/DBIx/Class/Schema.pm index 57b4b99..a7080e2 100644 --- a/lib/DBIx/Class/Schema.pm +++ b/lib/DBIx/Class/Schema.pm @@ -543,6 +543,8 @@ name. sub resultset { my ($self, $moniker) = @_; + $self->throw_exception('resultset() expects a source name') + unless defined $moniker; return $self->source($moniker)->resultset; } diff --git a/t/60core.t b/t/60core.t index c494b74..d430398 100644 --- a/t/60core.t +++ b/t/60core.t @@ -452,4 +452,6 @@ SKIP: { } } +throws_ok { $schema->resultset} qr/resultset\(\) expects a source name/, 'resultset with no argument throws exception'; + done_testing;