X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=catagits%2FCatalyst-Controller-DBIC-API.git;a=blobdiff_plain;f=lib%2FCatalyst%2FController%2FDBIC%2FAPI.pm;h=99e11b7a3550d23f63665690c05eb5c8476e7a07;hp=03cb156713382ee730337d2bb6636c05d19f3db0;hb=a80eb0e8fb994dc05e4d7e2d54108ad1d7d670a4;hpb=5342922077bf786606e96f023f30f420b70ecead diff --git a/lib/Catalyst/Controller/DBIC/API.pm b/lib/Catalyst/Controller/DBIC/API.pm index 03cb156..99e11b7 100644 --- a/lib/Catalyst/Controller/DBIC/API.pm +++ b/lib/Catalyst/Controller/DBIC/API.pm @@ -932,6 +932,8 @@ push_error stores an error message into the stash to be later retrieved by L{message}) { $error = $params->{message}; @@ -951,9 +953,24 @@ get_errors returns all of the errors stored in the stash sub get_errors { my ( $self, $c ) = @_; + die 'Catalyst app object missing' + unless defined $c; 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.