fix: catch error response
This commit is contained in:
parent
79279e4ab1
commit
c9e7c103c7
1 changed files with 9 additions and 1 deletions
|
@ -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",
|
||||
};
|
||||
}
|
||||
---
|
||||
|
||||
<Layout title={article?.title}>
|
||||
|
|
Loading…
Reference in a new issue