[Bps-public-commit] r14512 - in Prophet/trunk: .
sartak at bestpractical.com
sartak at bestpractical.com
Fri Jul 25 07:03:43 EDT 2008
Author: sartak
Date: Fri Jul 25 07:03:41 2008
New Revision: 14512
Modified:
Prophet/trunk/ (props changed)
Prophet/trunk/lib/Prophet/Record.pm
Log:
r65199 at onn: sartak | 2008-07-25 06:32:23 -0400
Explode more gracefully when getting/setting/deleting props of an unloaded record
Modified: Prophet/trunk/lib/Prophet/Record.pm
==============================================================================
--- Prophet/trunk/lib/Prophet/Record.pm (original)
+++ Prophet/trunk/lib/Prophet/Record.pm Fri Jul 25 07:03:41 2008
@@ -232,6 +232,8 @@
my $self = shift;
my %args = validate( @_, { props => 1 } );
+ confess "set_props called on a record that hasn't been loaded or created yet." if !$self->uuid;
+
$self->canonicalize_props( $args{'props'} );
$self->validate_props( $args{'props'} ) || return undef;
$self->handle->set_record_props(
@@ -250,6 +252,9 @@
sub get_props {
my $self = shift;
+
+ confess "get_props called on a record that hasn't been loaded or created yet." if !$self->uuid;
+
return $self->handle->get_record_props(
uuid => $self->uuid,
type => $self->type
@@ -280,6 +285,9 @@
sub delete_prop {
my $self = shift;
my %args = validate( @_, { name => 1 } );
+
+ confess "delete_prop called on a record that hasn't been loaded or created yet." if !$self->uuid;
+
$self->handle->delete_record_prop(
uuid => $self->uuid,
name => $args{'name'}
More information about the Bps-public-commit
mailing list