Verified Commit b40c12ef authored by Jordan Petridis's avatar Jordan Petridis 🌱

Pipeline: Avoid spamming stderr when not needed

This commit add a new DataError Variant for feeds that return 304.
Its expected behaviror and the current API of Source::into_feed
is kinda limiting the return type to make it easier to handle.

Up till now 304 was returning an Error to early return. Ideally
Source::into_feed will return a Multi variant Result Enum.


enum FeedResult {

Hopefully in a refactor in the near Future

Till then we will just have to match and ignore
parent 3c5ddad1
......@@ -65,6 +65,8 @@ pub enum DataError {
#[fail(display = "Source redirects to a new url")]
#[fail(display = "Feed is up to date")]
display = "Error occured while Parsing an Episode. Reason: {}",
......@@ -144,7 +144,10 @@ impl Source {
match code {
StatusCode::NotModified => return Err(self.make_err("304: skipping..", code)),
StatusCode::NotModified => {
info!("304: Source, (id: {}), is up to date",;
return Err(DataError::FeedNotModified(self));
StatusCode::MovedPermanently | StatusCode::Found | StatusCode::PermanentRedirect => {
warn!("Feed was moved permanently.");
self = self.update_url(&res)?;
......@@ -38,8 +38,13 @@ where
// the stream will stop at the first error so
// we ensure that everything will succeded regardless.
.map_err(|err| error!("Error: {}", err))
.then(|_| ok::<(), DataError>(()))
.map_err(|err| {
match err {
// Avoid spamming the stderr when its not an eactual error
DataError::FeedNotModified(_) => (),
_ => error!("Error: {}", err),
}).then(|_| ok::<(), DataError>(()))
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment