fix: preserve ebay rate-limit fallback

This commit is contained in:
2026-04-29 14:52:08 -04:00
parent 82e7abc057
commit 5d86a4e54d
2 changed files with 18 additions and 3 deletions

View File

@@ -9,7 +9,7 @@ import {
ensureCookies,
formatCookiesForHeader,
} from "../utils/cookies";
import { fetchHtml, HttpError } from "../utils/http";
import { fetchHtml, HttpError, RateLimitError } from "../utils/http";
import { logger } from "../utils/logger";
import { classifyUnstableListings } from "../utils/unstable";
@@ -511,9 +511,9 @@ export default async function fetchEbayItems(
logger.log(`Parsed ${filteredListings.length} eBay listings.`);
return finalizeResults(filteredListings);
} catch (err) {
if (err instanceof HttpError) {
if (err instanceof HttpError || err instanceof RateLimitError) {
logger.warn(
`Failed to fetch eBay search (${err.statusCode}): ${err.message}`,
`Failed to fetch eBay search (${err instanceof HttpError ? err.statusCode : 429}): ${err.message}`,
);
return finalizeResults([]);
}