Add error handling for API calls during build time

This commit is contained in:
Unchained
2026-03-06 16:30:54 +02:00
parent 40b80b1ad0
commit 8aa849f4ba
2 changed files with 13 additions and 2 deletions

View File

@@ -9,7 +9,12 @@ export const metadata = {
};
export default async function ProductsPage() {
const products = await getProducts();
let products: any[] = [];
try {
products = await getProducts();
} catch (e) {
console.log('Failed to fetch products during build');
}
const publishedProducts = products.filter((p) => p.status === "publish");