Pimp error where no document is provided

This commit is contained in:
many 2021-10-28 12:13:51 +02:00
parent ff0908d3fa
commit 59636fa688
No known key found for this signature in database
GPG key ID: 2CEF23B75189EACA
3 changed files with 30 additions and 20 deletions

View file

@ -174,18 +174,15 @@ impl UpdateLoop {
}
let reader = Cursor::new(buffer);
let document_count = match format {
match format {
DocumentAdditionFormat::Json => read_json(reader, &mut *update_file)?,
DocumentAdditionFormat::Csv => read_csv(reader, &mut *update_file)?,
DocumentAdditionFormat::Ndjson => read_ndjson(reader, &mut *update_file)?,
};
if document_count > 0 {
update_file.persist()?;
Ok(())
} else {
Err(UpdateLoopError::MissingPayload(format))
}
update_file.persist()?;
Ok(())
})
.await??;