Temporariamente indisponível. Tenta novamente dentro de uns minutos.
+diff --git a/apps/site/src/app/home-data.ts b/apps/site/src/app/home-data.ts index 79086ef..f9af6dc 100644 --- a/apps/site/src/app/home-data.ts +++ b/apps/site/src/app/home-data.ts @@ -19,6 +19,8 @@ export async function load(q: string, sport: string) { ]); } catch (err) { if (err instanceof NotFound) return null; - throw err; + // Transient API/DB errors (e.g. Postgres pool exhaustion) degrade to null so the page shows + // a neutral message instead of crashing and feeding the error loop reporter. + return null; } } diff --git a/apps/site/src/app/layout.tsx b/apps/site/src/app/layout.tsx index ae469cb..76071a5 100644 --- a/apps/site/src/app/layout.tsx +++ b/apps/site/src/app/layout.tsx @@ -40,7 +40,21 @@ export default async function RootLayout({ children }: { children: ReactNode }) try { site = await getSite(); } catch (err) { - if (!(err instanceof NotFound)) throw err; + if (!(err instanceof NotFound)) { + // Transient API/DB errors (e.g. Postgres pool exhaustion) must not crash the layout — + // instrumentation.ts reports every thrown error to errors.bitreport.pt, creating an error + // loop. Render a minimal shell so the page returns 200 without a thrown error. + return ( + +
+Temporariamente indisponível. Tenta novamente dentro de uns minutos.
+