various bugfixes

This commit is contained in:
Simon
2026-01-13 18:13:51 +00:00
parent aaff7d00c6
commit 34992242b7
21 changed files with 243 additions and 289 deletions

View File

@@ -3,7 +3,7 @@ use crate::api::ClientVersion;
use crate::providers::Provider;
use crate::status::*;
use crate::util::cache::VideoCache;
use crate::util::discord::send_discord_error_report;
use crate::util::discord::{format_error_chain, send_discord_error_report};
use crate::util::requester::Requester;
use crate::util::time::parse_time_to_seconds;
use crate::videos::{ServerOptions, VideoFormat, VideoItem};
@@ -215,15 +215,16 @@ impl JavtifulProvider {
Some(b) => b,
None => {
eprint!("Javtiful Provider: Failed to get block from html");
let err = Error::from(ErrorKind::Parse("html".into()));
let _ = futures::executor::block_on(send_discord_error_report(
&err,
Some("Javtiful Provider"),
Some(&format!("Failed to get block from html:\n```{html}\n```")),
file!(),
line!(),
module_path!(),
));
let e = Error::from(ErrorKind::Parse("html".into()));
send_discord_error_report(
e.to_string(),
Some(format_error_chain(&e)),
Some("Javtiful Provider"),
Some(&format!("Failed to get block from html:\n```{html}\n```")),
file!(),
line!(),
module_path!(),
).await;
return vec![]
},
};
@@ -239,14 +240,22 @@ impl JavtifulProvider {
.inspect(|r| {
if let Err(e) = r {
eprint!("Javtiful Provider: Failed to get video item:{}\n", e);
let _ = futures::executor::block_on(send_discord_error_report(
&e,
Some("Javtiful Provider"),
Some("Failed to get video item"),
file!(),
line!(),
module_path!(),
));
// Prepare data to move into the background task
let msg = e.to_string();
let chain = format_error_chain(&e);
// Spawn the report into the background - NO .await here
tokio::spawn(async move {
let _ = send_discord_error_report(
msg,
Some(chain),
Some("Javtiful Provider"),
Some("Failed to get video item"),
file!(), // Note: these might report the utility line
line!(), // better to hardcode or pass from outside
module_path!(),
).await;
});
}
})
.filter_map(Result::ok)
@@ -400,7 +409,7 @@ impl Provider for JavtifulProvider {
})
}
fn get_channel(&self, v: ClientVersion) -> Channel {
self.build_channel(v)
fn get_channel(&self, v: ClientVersion) -> Option<Channel> {
Some(self.build_channel(v))
}
}