Refactor: move public storefront stop data to server-side + parallel agent work
Server-side / caching refactor (Grok): - New RPC get_public_stops_for_brand (migration 148) for public storefront stops - New server action getPublicStopsForBrand with revalidate=300 + tags - Add revalidateTag invalidation to createStopsBatch + publishStop - Convert /tuxedo/stops and /indian-river-direct/stops to Server Components - Extract TuxedoStopsList + IndianRiverStopsList as client islands (GSAP only) - Removes supabase-js from browser bundle on those routes - Both pages now statically prerendered (5m ISR) Parallel agent changes also staged: - AI provider model list refresh (claude-sonnet-4-5, etc.) - ESLint directive patches for react-hooks/set-state-in-effect - Admin + storefront + checkout + cart updates - New admin_create_stop_rpcs migration (147) - Misc fixes across ~90 files Build verified: typecheck clean, lint clean on new files, production build succeeds.
This commit is contained in:
@@ -87,8 +87,20 @@ export async function POST(req: NextRequest) {
|
||||
model,
|
||||
});
|
||||
} catch (err) {
|
||||
return NextResponse.json({
|
||||
error: "Connection test failed. Check your API key and endpoint.",
|
||||
}, { status: 500 });
|
||||
// Surface the actual SDK/API error so users can tell whether the
|
||||
// failure is a bad key, a retired model, a quota issue, or a network
|
||||
// problem — not a generic "check your key" message.
|
||||
const message =
|
||||
err instanceof Error
|
||||
? err.message
|
||||
: typeof err === "string"
|
||||
? err
|
||||
: "Connection test failed. Check your API key and endpoint.";
|
||||
// Some SDKs throw non-Error objects with a .status / .error property
|
||||
const status =
|
||||
(typeof err === "object" && err && "status" in err && typeof (err as { status?: unknown }).status === "number"
|
||||
? (err as { status: number }).status
|
||||
: undefined) ?? 500;
|
||||
return NextResponse.json({ error: message }, { status: status >= 400 && status < 600 ? status : 500 });
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user