Replace last bail! invocations.

This commit is contained in:
Jordan Petridis
2018-02-05 19:00:31 +02:00
parent 008f57bec4
commit 44ebe46f10
4 changed files with 7 additions and 5 deletions
+4
View File
@@ -46,6 +46,10 @@ pub enum DataError {
},
#[fail(display = "Error occured while Parsing an Episode. Reason: {}", reason)]
ParseEpisodeError { reason: String, parent_id: i32 },
#[fail(display = "No Futures where produced to be run.")]
EmptyFuturesList,
#[fail(display = "Episode was not changed and thus skipped.")]
EpisodeNotChanged,
}
impl From<RunMigrationsError> for DataError {
+1 -1
View File
@@ -96,7 +96,7 @@ impl Feed {
// I am not sure what the optimizations are on match vs allocating None.
.map(|fut| {
fut.and_then(|x| match x {
IndexState::NotChanged => return Err(DataError::DiscountBail(format!("Nothing to do here."))),
IndexState::NotChanged => return Err(DataError::EpisodeNotChanged),
_ => Ok(x),
})
})
+1 -1
View File
@@ -27,7 +27,7 @@ extern crate derive_builder;
extern crate diesel;
#[macro_use]
extern crate diesel_migrations;
#[macro_use]
// #[macro_use]
extern crate failure;
#[macro_use]
extern crate failure_derive;
+1 -3
View File
@@ -58,9 +58,7 @@ pub fn pipeline<S: IntoIterator<Item = Source>>(
.collect();
if list.is_empty() {
return Err(DataError::DiscountBail(format!(
"No futures were found to run."
)));
return Err(DataError::EmptyFuturesList);
}
// Thats not really concurrent yet I think.