From 9e78a32d8d1bd785ef20894c2471031b528f4b36 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20FAMIBELLE-PRONZOLA?= Date: Mon, 16 Dec 2024 13:34:05 +0400 Subject: [PATCH] fix: error when no titre or article --- app/page.js | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/app/page.js b/app/page.js index 4041ca6..9cf2db9 100644 --- a/app/page.js +++ b/app/page.js @@ -49,16 +49,12 @@ async function getData() { }) ) - if (titres.length === 0 || articles.length === 0) { - throw new Error('No data') - } - return { titres, articles } - } catch { - throw new Error('Failed to fetch data') + } catch (error) { + throw new Error(error.cause) } }