From 7d50a6da87c12321d6b7ba9a3b158c84c4703b76 Mon Sep 17 00:00:00 2001 From: SX-9 <90962949+SX-9@users.noreply.github.com> Date: Sat, 9 Nov 2024 12:06:15 +0700 Subject: [PATCH] error handling and minor changes --- src/routes/+layout.ts | 21 ++++++++++++++++++--- src/routes/+page.svelte | 10 +++++----- 2 files changed, 23 insertions(+), 8 deletions(-) diff --git a/src/routes/+layout.ts b/src/routes/+layout.ts index a1909d8..08fbbf7 100644 --- a/src/routes/+layout.ts +++ b/src/routes/+layout.ts @@ -7,9 +7,24 @@ export const load = (async () => { return { ...info, fetched: { - discord: await discord(info.discord), - github: await github(7, info.github), - blog: await blog(info.blog.api, info.blog.base), + discord: await discord(info.discord).catch((err) => ({ + username: '', + status: '', + activity: [], + spotify: { + song: '', + art: '', + link: '', + artist: '', + }, + })), + github: await github(7, info.github).catch((err) => ([])), + blog: await blog(info.blog.api, info.blog.base).catch((err) => ({ + title: 'Error', + desc: err, + url: info.blog.base, + created: new Date(), + })), }, }; }) satisfies LayoutLoad; \ No newline at end of file diff --git a/src/routes/+page.svelte b/src/routes/+page.svelte index 1300983..1d943f2 100644 --- a/src/routes/+page.svelte +++ b/src/routes/+page.svelte @@ -108,14 +108,14 @@