added has_errors method
Alexander Hartmaier [Tue, 22 Mar 2011 10:39:03 +0000 (11:39 +0100)]
Changes
lib/Catalyst/Controller/DBIC/API.pm

diff --git a/Changes b/Changes
index e711e2b..6c76114 100644 (file)
--- 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
index 03cb156..de143e6 100644 (file)
@@ -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<DBIx::Class> schema classes. Module provides both RPC and REST interfaces to base functionality. Uses L<Catalyst::Action::Serialize> and L<Catalyst::Action::Deserialize> to serialise response and/or deserialise request.