New Items don't have a full key yet so it cannot be put in the error message. Instead indicate the error happened on a new object and give its partial key.
Signed-off-by: Francois Gouget fgouget@codeweavers.com --- testbot/lib/ObjectModel/Collection.pm | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-)
diff --git a/testbot/lib/ObjectModel/Collection.pm b/testbot/lib/ObjectModel/Collection.pm index c110c98b..1fe1481f 100644 --- a/testbot/lib/ObjectModel/Collection.pm +++ b/testbot/lib/ObjectModel/Collection.pm @@ -495,11 +495,16 @@ sub Validate($) { if ($Item->GetIsNew() || $Item->GetIsModified()) { - (my $ErrProperty, my $ErrMessage) = $Item->Validate(); - if (defined($ErrMessage)) + my ($ErrProperty, $ErrMessage) = $Item->Validate(); + if (defined $ErrMessage) { - return ($Item->GetKey(), $ErrProperty, "$ErrMessage for " . - $self->GetItemName() . " " . $Item->GetFullKey()); + my $Key = $Item->GetKey(); + my $FullKey = $Item->GetFullKey(); + if (defined $FullKey) + { + return ($Key, $ErrProperty, "$ErrMessage for ". $self->GetItemName() ." $FullKey"); + } + return ($Key, $ErrProperty, "$ErrMessage for new ". $self->GetItemName() ." $Key"); } if ($Item->GetIsNew()) {