diff --git a/perl_lib/EPrints/Apache/CRUD.pm b/perl_lib/EPrints/Apache/CRUD.pm index 2dc20286..07680846 100644 --- a/perl_lib/EPrints/Apache/CRUD.pm +++ b/perl_lib/EPrints/Apache/CRUD.pm @@ -1008,7 +1008,7 @@ sub parse_input } elsif( $count == 0 || ( $list->count == 0 && $self->{method} ne "PUT" && $self->{method} ne "PATCH" ) ) { - $plugin->handler->message( "error", "Import plugin didn't create anything" ); + $plugin->handler->message( "error", "Import plugin didn't create anything. Check ".$repo->config( 'perl_url' )."/schema to ensure the metadata being sent is valid." ); $self->plugin_error( $plugin, \@messages ); return undef; } diff --git a/perl_lib/EPrints/Database.pm b/perl_lib/EPrints/Database.pm index c58d55ee..2c4b6a07 100644 --- a/perl_lib/EPrints/Database.pm +++ b/perl_lib/EPrints/Database.pm @@ -1911,7 +1911,15 @@ sub add_record } # Now add the ACTUAL data: - return $self->update( $dataset, $data, $data ); + my $rc = $self->update( $dataset, $data, $data ); + + # If the update failed then delete the empty record created by the earlier insert + if ( !$rc ) + { + $self->remove( $dataset, $id ); + } + + return $rc; }