From 68759e64d13714fa302e996db7cae7c10203850f Mon Sep 17 00:00:00 2001 From: Lim Chee Aun Date: Mon, 9 Oct 2023 21:53:58 +0800 Subject: [PATCH] Silence errors for follow requests & announcements --- src/pages/notifications.jsx | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/src/pages/notifications.jsx b/src/pages/notifications.jsx index fb1a1393..2a6f8517 100644 --- a/src/pages/notifications.jsx +++ b/src/pages/notifications.jsx @@ -92,11 +92,16 @@ function Notifications({ columnMode }) { return allNotifications; } - function fetchFollowRequests() { + async function fetchFollowRequests() { // Note: no pagination here yet because this better be on a separate page. Should be rare use-case??? - return masto.v1.followRequests.list({ - limit: 80, - }); + try { + return await masto.v1.followRequests.list({ + limit: 80, + }); + } catch (e) { + // Silently fail + return []; + } } const loadFollowRequests = () => { @@ -112,8 +117,13 @@ function Notifications({ columnMode }) { })(); }; - function fetchAnnouncements() { - return masto.v1.announcements.list(); + async function fetchAnnouncements() { + try { + return await masto.v1.announcements.list(); + } catch (e) { + // Silently fail + return []; + } } const loadNotifications = (firstLoad) => {