S002: timeout errors as user cards
Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
This commit is contained in:
parent
2168277fe3
commit
feed5ec7de
3 changed files with 7 additions and 4 deletions
|
|
@ -33,7 +33,7 @@ pub async fn run(args: &[String], limit: Duration) -> Result<(), String> {
|
|||
cmd.args(["-hide_banner", "-loglevel", "error", "-nostdin", "-y"]).args(args).stdin(Stdio::null()).stdout(Stdio::null()).stderr(Stdio::piped()).kill_on_drop(true);
|
||||
let child = cmd.spawn().map_err(|e| format!("ffmpeg isn't installed or can't start ({e})"))?;
|
||||
match tokio::time::timeout(limit, child.wait_with_output()).await {
|
||||
Err(_) => Err("that took too long".to_string()),
|
||||
Err(_) => Err("The conversion took too long (slow connection or a very big file). Try a smaller file or lower quality.".to_string()),
|
||||
Ok(Err(e)) => Err(e.to_string()),
|
||||
Ok(Ok(out)) if out.status.success() => Ok(()),
|
||||
Ok(Ok(out)) => {
|
||||
|
|
|
|||
|
|
@ -184,7 +184,7 @@ pub async fn extract(query: &str, mode: Mode) -> Result<Value, String> {
|
|||
}
|
||||
};
|
||||
cmd.arg("--").arg(query).stdin(Stdio::null()).kill_on_drop(true);
|
||||
let out = tokio::time::timeout(Duration::from_secs(limit), cmd.output()).await.map_err(|_| "That took too long — try again.".to_string())?.map_err(|e| format!("yt-dlp can't start ({e})"))?;
|
||||
let out = tokio::time::timeout(Duration::from_secs(limit), cmd.output()).await.map_err(|_| "The song lookup took too long (YouTube or the connection is slow). Try again in a bit.".to_string())?.map_err(|e| format!("yt-dlp can't start ({e})"))?;
|
||||
if !out.status.success() {
|
||||
return Err(clean_error(&String::from_utf8_lossy(&out.stderr)));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -70,7 +70,7 @@ async fn wait(state: &State, key: &str, analysis: &str, after: &str) -> Result<V
|
|||
}
|
||||
tokio::time::sleep(Duration::from_secs(8)).await;
|
||||
}
|
||||
Err("VirusTotal took too long — try again in a few minutes".into())
|
||||
Err("VirusTotal took too long to scan this (over 5 minutes). Try again in a few minutes.".into())
|
||||
}
|
||||
|
||||
async fn scan_url(state: &State, key: &str, url: &str) -> Result<Value, String> {
|
||||
|
|
|
|||
Loading…
Reference in a new issue