aboutsummaryrefslogtreecommitdiffstats
path: root/crates
diff options
context:
space:
mode:
authorBenedikt Peetz <benedikt.peetz@b-peetz.de>2025-06-28 17:08:17 +0200
committerBenedikt Peetz <benedikt.peetz@b-peetz.de>2025-06-28 17:08:17 +0200
commitc5ad75c9176990da906c9ef3086e8efe25037fd9 (patch)
tree943f88a2d62a6f56cdb8bde32c9ad528c3305423 /crates
parentfix(yt/{subscribe,storage/subscriptions}): Fix more instances of the capitali... (diff)
downloadyt-c5ad75c9176990da906c9ef3086e8efe25037fd9.zip
fix(yt/subscribe): Don't hard-error on failed subscribe, if it was not specified
The user did not specify to subscribe to the `videos`, `streams` and `shorts` variants, as such we should not error if one of them fails, as the other one could succeed.
Diffstat (limited to '')
-rw-r--r--crates/yt/src/subscribe/mod.rs23
1 files changed, 16 insertions, 7 deletions
diff --git a/crates/yt/src/subscribe/mod.rs b/crates/yt/src/subscribe/mod.rs
index ad074fb..66797e8 100644
--- a/crates/yt/src/subscribe/mod.rs
+++ b/crates/yt/src/subscribe/mod.rs
@@ -13,7 +13,7 @@ use std::str::FromStr;
use anyhow::{Context, Result, bail};
use futures::FutureExt;
-use log::warn;
+use log::{error, warn};
use tokio::io::{AsyncBufRead, AsyncBufReadExt};
use url::Url;
use yt_dlp::{json_cast, json_get, options::YoutubeDLOptions};
@@ -121,17 +121,26 @@ pub async fn subscribe(app: &App, name: Option<String>, url: Url) -> Result<()>
out?;
} else {
- actual_subscribe(app, None, url.join("videos/").unreachable("See above."))
+ let _ = actual_subscribe(app, None, url.join("videos/").unreachable("See above."))
.await
- .with_context(|| format!("Failed to subscribe to the '{}' variant", "{Videos}"))?;
+ .map_err(|err| {
+ error!("Failed to subscribe to the '{}' variant: {err}", "{Videos}");
+ });
- actual_subscribe(app, None, url.join("streams/").unreachable("See above."))
+ let _ = actual_subscribe(app, None, url.join("streams/").unreachable("See above."))
.await
- .with_context(|| format!("Failed to subscribe to the '{}' variant", "{Streams}"))?;
+ .map_err(|err| {
+ error!(
+ "Failed to subscribe to the '{}' variant: {err}",
+ "{Streams}"
+ );
+ });
- actual_subscribe(app, None, url.join("shorts/").unreachable("See above."))
+ let _ = actual_subscribe(app, None, url.join("shorts/").unreachable("See above."))
.await
- .with_context(|| format!("Failed to subscribe to the '{}' variant", "{Shorts}"))?;
+ .map_err(|err| {
+ error!("Failed to subscribe to the '{}' variant: {err}", "{Shorts}");
+ });
}
} else {
actual_subscribe(app, name, url).await?;