From: Andrew Rodland Date: Tue, 9 Nov 2010 01:19:04 +0000 (-0600) Subject: Croak more intelligently when attrs->{page} is an unexpected value X-Git-Tag: v0.08125~56 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=9f2baadf578157afd2130127f76ae07b17fbbdc5;p=dbsrgits%2FDBIx-Class.git Croak more intelligently when attrs->{page} is an unexpected value --- diff --git a/lib/DBIx/Class/ResultSet.pm b/lib/DBIx/Class/ResultSet.pm index 5609572..0a6963b 100644 --- a/lib/DBIx/Class/ResultSet.pm +++ b/lib/DBIx/Class/ResultSet.pm @@ -1957,8 +1957,12 @@ sub pager { } my $attrs = $self->{attrs}; - $self->throw_exception("Can't create pager for non-paged rs") - unless $self->{attrs}{page}; + if (!defined $attrs->{page}) { + $self->throw_exception("Can't create pager for non-paged rs"); + } + elsif ($attrs->{page} <= 0) { + $self->throw_exception('Invalid page number (page-numbers are 1-based)'); + } $attrs->{rows} ||= 10; # throw away the paging flags and re-run the count (possibly