mirror of
https://github.com/TheFunny/TelegramTwitterMediaBot.git
synced 2026-09-23 23:32:05 +00:00
site: classify HTTP status codes, make transient failures retryable
Twitter (syndication + auth GraphQL) mapped every non-2xx to NotFound, killing retries on 429/5xx; bsky never checked status; pixiv network errors arrived wrapped in PixivError and were excluded from the retry loop. New FetchError::Transient covers 429/5xx from all sites, the retry loop now also retries Pixiv errors, and 404/410 stay permanent.
This commit is contained in:
@@ -136,6 +136,12 @@ impl PixivAPI {
|
||||
.bearer_auth(access_token)
|
||||
.send()
|
||||
.await?;
|
||||
if !response.status().is_success() {
|
||||
return Err(PixivError::Api(format!(
|
||||
"status {}",
|
||||
response.status()
|
||||
)));
|
||||
}
|
||||
let json: serde_json::Value = serde_json::from_str(&response.text().await?)?;
|
||||
if json.get("error").is_some() {
|
||||
let message = json
|
||||
@@ -186,6 +192,12 @@ impl PixivAPI {
|
||||
.bearer_auth(access_token)
|
||||
.send()
|
||||
.await?;
|
||||
if !response.status().is_success() {
|
||||
return Err(PixivError::Api(format!(
|
||||
"status {}",
|
||||
response.status()
|
||||
)));
|
||||
}
|
||||
let json: serde_json::Value = serde_json::from_str(&response.text().await?)?;
|
||||
if json.get("error").is_some() {
|
||||
let message = json
|
||||
|
||||
Reference in New Issue
Block a user