From: Alexander Hartmaier Date: Tue, 22 Mar 2011 10:39:03 +0000 (+0100) Subject: added has_errors method X-Git-Tag: 2.003002~8 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=catagits%2FCatalyst-Controller-DBIC-API.git;a=commitdiff_plain;h=71c17090d68f61e915d6c56c12b7d49e5dac4ca4 added has_errors method --- diff --git a/Changes b/Changes index e711e2b..6c76114 100644 --- a/Changes +++ b/Changes @@ -2,6 +2,8 @@ Revision history for Catalyst-Controller-DBIC-API: {{ $dist->version }} {{ $NEXT }} +- Added has_errors method + 2.003001 2011-02-16 17:52:37 Europe/Vienna - Use JSON instead of JSON::Any to get rid of the CPAN Testers failures diff --git a/lib/Catalyst/Controller/DBIC/API.pm b/lib/Catalyst/Controller/DBIC/API.pm index 03cb156..de143e6 100644 --- a/lib/Catalyst/Controller/DBIC/API.pm +++ b/lib/Catalyst/Controller/DBIC/API.pm @@ -954,6 +954,19 @@ sub get_errors return $c->stash->{_dbic_crud_errors}; } +=method_protected has_errors + +returns returns true if errors are stored in the stash + +=cut + +sub has_errors { + my ( $self, $c ) = @_; + die 'Catalyst app object missing' + unless defined $c; + return exists $c->stash->{_dbic_crud_errors}; +} + =head1 DESCRIPTION Easily provide common API endpoints based on your L schema classes. Module provides both RPC and REST interfaces to base functionality. Uses L and L to serialise response and/or deserialise request.