From c9e7c103c74db3f7639a99ed66cb9fd32d1134a4 Mon Sep 17 00:00:00 2001 From: Ayo Date: Fri, 12 May 2023 22:11:46 +0200 Subject: [PATCH] fix: catch error response --- src/pages/index.astro | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/pages/index.astro b/src/pages/index.astro index 1804488..234f6bc 100644 --- a/src/pages/index.astro +++ b/src/pages/index.astro @@ -9,7 +9,15 @@ import Layout from "../layouts/layout.astro"; const params = getParams(Astro.url); const url: string = params?.url || ""; -const article = isURL(url) && (await extract(url)); +let article; +try { + article = isURL(url) && (await extract(url)); +} catch { + article = { + title: "Something is not right", + content: "The articl extractor did not get any result", + }; +} ---