Currently ingest_entries panics. This makes it hard to use ingest_entries in parallel with other processes. When another process runs into an error and wants to return so, while ingest_entries has already started and has no entries yet, we're forced to panic. With this change ingest_entries will return an error when there are no entries, thus allowing the user to handle the errors as they please. Change-Id: I78b85bf18f52af8c157d6bedad6019fd4398250a Reviewed-on: https://cl.tvl.fyi/c/depot/+/13146 Reviewed-by: flokli <flokli@flokli.de> Autosubmit: Bob van der Linden <bobvanderlinden@gmail.com> Reviewed-by: Bob van der Linden <bobvanderlinden@gmail.com> Tested-by: BuildkiteCI
23 lines
731 B
Rust
23 lines
731 B
Rust
use super::PathBuf;
|
|
|
|
use crate::Error as CastoreError;
|
|
|
|
/// Represents all error types that emitted by ingest_entries.
|
|
/// It can represent errors uploading individual Directories and finalizing
|
|
/// the upload.
|
|
/// It also contains a generic error kind that'll carry ingestion-method
|
|
/// specific errors.
|
|
#[derive(Debug, thiserror::Error)]
|
|
pub enum IngestionError<E: std::fmt::Display> {
|
|
#[error("error from producer: {0}")]
|
|
Producer(#[from] E),
|
|
|
|
#[error("failed to upload directory at {0}: {1}")]
|
|
UploadDirectoryError(PathBuf, CastoreError),
|
|
|
|
#[error("failed to finalize directory upload: {0}")]
|
|
FinalizeDirectoryUpload(CastoreError),
|
|
|
|
#[error("unexpected end of stream")]
|
|
UnexpectedEndOfStream,
|
|
}
|