diff --git a/api/src/routes/dot-lookup.ts b/api/src/routes/dot-lookup.ts index 2dd581d..6e9d995 100644 --- a/api/src/routes/dot-lookup.ts +++ b/api/src/routes/dot-lookup.ts @@ -66,23 +66,13 @@ router.get("/api/v1/dot/lookup", async (req, res) => { ); const census = local.rows[0] || null; - // 2. Live FMCSA API — wrapped so a timeout or outage still returns census data - let carrier: any = null; - try { - const snapshot = await fmcsaFetch(rawDot); - carrier = snapshot?.content?.carrier || null; - } catch { - // FMCSA live API unavailable — continue with local census data - } + // 2. Live FMCSA API (returns null on any failure — already non-throwing) + const snapshot = await fmcsaFetch(rawDot); + const carrier = snapshot?.content?.carrier || null; - // 3. Authority check — also non-fatal - let authorities: any[] = []; - try { - const authorityData = await fmcsaFetch(`${rawDot}/authority`); - authorities = (authorityData?.content || []).map((a: any) => a.carrierAuthority); - } catch { - // Authority lookup failed — skip, checks will use census data where possible - } + // 3. Authority check + const authorityData = await fmcsaFetch(`${rawDot}/authority`); + const authorities = (authorityData?.content || []).map((a: any) => a.carrierAuthority); if (!census && !carrier) { res.status(404).json({ error: `DOT# ${rawDot} not found.` });