diff --git a/site/src/pages/tools/fcc-compliance-check.astro b/site/src/pages/tools/fcc-compliance-check.astro
index 4ba200d..1d80a8c 100644
--- a/site/src/pages/tools/fcc-compliance-check.astro
+++ b/site/src/pages/tools/fcc-compliance-check.astro
@@ -100,7 +100,7 @@ import Base from "../../layouts/Base.astro";
@@ -338,8 +338,17 @@ import Base from "../../layouts/Base.astro";
frnInput.addEventListener("keydown", (e) => { if (e.key === "Enter") runCheck(); });
async function runCheck() {
- const frn = frnInput.value.trim();
- if (!frn) return;
+ const raw = frnInput.value.trim().replace(/\D/g, "");
+ if (!raw) {
+ showError("Please enter a 10-digit FRN.");
+ return;
+ }
+ if (raw.length !== 10) {
+ showError("FRN must be exactly 10 digits (e.g., 0012345678). You entered " + raw.length + " digits.");
+ return;
+ }
+ const frn = raw.padStart(10, "0");
+ frnInput.value = frn;
// Update URL
const url = new URL(window.location);
@@ -352,22 +361,38 @@ import Base from "../../layouts/Base.astro";
loadingEl.classList.remove("hidden");
try {
- const res = await fetch(`${API}/api/v1/fcc/lookup?frn=${frn}`);
+ const controller = new AbortController();
+ const timeout = setTimeout(() => controller.abort(), 30000);
+
+ const res = await fetch(`${API}/api/v1/fcc/lookup?frn=${frn}`, { signal: controller.signal });
+ clearTimeout(timeout);
+
if (!res.ok) {
const body = await res.json().catch(() => ({}));
- throw new Error(body.detail || body.error || `Lookup failed (${res.status})`);
+ if (res.status === 400) {
+ throw new Error(body.error || "Invalid FRN format. Please check and try again.");
+ }
+ throw new Error(body.error || "FCC lookup failed. Please try again.");
}
const data = await res.json();
+ if (!data.entity_name && !data.cores?.entity_name && !data.filer_499) {
+ showError('FRN ' + frn + ' was not found in any FCC database. Verify your number at
FCC CORES.');
+ return;
+ }
renderResults(data);
} catch (err) {
- showError(err.message);
+ if (err.name === "AbortError") {
+ showError("The FCC databases are taking too long to respond. Please try again in a few moments.");
+ } else {
+ showError(err.message || "Could not reach the FCC databases. Please check your internet connection and try again.");
+ }
} finally {
loadingEl.classList.add("hidden");
}
}
function showError(msg) {
- errorMessage.textContent = msg;
+ errorMessage.innerHTML = msg;
errorBox.classList.remove("hidden");
}