From af36ddd8ed007562357333bae1f89aaa343cf4a5 Mon Sep 17 00:00:00 2001 From: Leilukin Date: Sun, 9 Jun 2024 15:20:32 +0800 Subject: [PATCH] Display an error message if status.cafe fails to be fetched --- src/_includes/main/statuscafe.njk | 1 + src/changelogs/logs/2024/2024-06-09.md | 5 +++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/_includes/main/statuscafe.njk b/src/_includes/main/statuscafe.njk index 26a7a626..d27c9d80 100644 --- a/src/_includes/main/statuscafe.njk +++ b/src/_includes/main/statuscafe.njk @@ -29,6 +29,7 @@ document.getElementById("statuscafe-content").innerHTML = data.content; } catch (error) { console.error(error); + document.getElementById("statuscafe-content").textContent = `[ERROR] ${error}`; } }; fetchStatusCafe(); diff --git a/src/changelogs/logs/2024/2024-06-09.md b/src/changelogs/logs/2024/2024-06-09.md index e09302ca..14df8e0b 100644 --- a/src/changelogs/logs/2024/2024-06-09.md +++ b/src/changelogs/logs/2024/2024-06-09.md @@ -3,7 +3,8 @@ date: 2024-06-09 --- * Convert most of the images on this website to AVIF format to reduce file size and save bandwidth. -* Improve status.cafe widget: +* Improve my status.cafe widget: * Write local JavaScript code to fetch data from status.cafe. - * Display a loading message before the status.cafe data is successfully fetched. + * Display a loading message before the data fetch request is completed. + * Display an error message if the data fetching fails. * Add a link to my status.cafe profile below the widget. \ No newline at end of file