From 33684a91529d36a7828a767ac51f556ba1f3b270 Mon Sep 17 00:00:00 2001 From: justin Date: Fri, 22 May 2026 00:39:38 -0500 Subject: [PATCH] Better error message when FCC 499 search is down FCC ColdFusion app returns 503 periodically. Show helpful message suggesting FRN search instead of generic "Search failed". Co-Authored-By: Claude Opus 4.6 (1M context) --- api/src/routes/fcc-lookup.ts | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/api/src/routes/fcc-lookup.ts b/api/src/routes/fcc-lookup.ts index f9da0c0..b429aed 100644 --- a/api/src/routes/fcc-lookup.ts +++ b/api/src/routes/fcc-lookup.ts @@ -1280,12 +1280,18 @@ router.get("/api/v1/fcc/cores-search", async (req, res) => { }); if (!resp.ok) { - res.status(502).json({ error: `FCC search returned ${resp.status}` }); + res.status(502).json({ error: `The FCC search system is temporarily unavailable (HTTP ${resp.status}). Try searching by FRN instead, or try again in a few minutes.` }); return; } const html = await resp.text(); + // FCC sometimes returns 200 but with a maintenance/error page + if (html.includes("Service Unavailable") || (html.includes("503") && !html.includes("499results"))) { + res.status(502).json({ error: "The FCC search system is temporarily unavailable. Try searching by FRN instead, or try again in a few minutes." }); + return; + } + // Parse the results table rows: 834314 ... Carrier One Inc.DBA const rowRegex = /(\d+)<\/th>\s*\n?\s*([^<]+)<\/a><\/td>([^<]*)<\/td><\/tr>/gi; const results: { filer_id: string; legal_name: string; dba: string }[] = [];