From: Henry Van Styn Date: Tue, 27 Sep 2016 12:46:14 +0000 (+0100) Subject: Improve exception text during write operations on uninserted objects X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=84bf5d8caa798edfa99e79d36d34c27604b28f18;p=dbsrgits%2FDBIx-Class.git Improve exception text during write operations on uninserted objects --- diff --git a/lib/DBIx/Class/Row.pm b/lib/DBIx/Class/Row.pm index cc66d74..7596f4a 100644 --- a/lib/DBIx/Class/Row.pm +++ b/lib/DBIx/Class/Row.pm @@ -556,7 +556,9 @@ sub update { my %to_update = $self->get_dirty_columns or return $self; - $self->throw_exception( "Not in database" ) unless $self->in_storage; + $self->throw_exception( + 'Result object not marked in_storage: an update() operation is not possible' + ) unless $self->in_storage; my $rows = $self->result_source->schema->storage->update( $self->result_source, \%to_update, $self->_storage_ident_condition @@ -618,7 +620,9 @@ See also L. sub delete { my $self = shift; if (ref $self) { - $self->throw_exception( "Not in database" ) unless $self->in_storage; + $self->throw_exception( + 'Result object not marked in_storage: a delete() operation is not possible' + ) unless $self->in_storage; $self->result_source->schema->storage->delete( $self->result_source, $self->_storage_ident_condition