From 0da23d28107c02699ad9f247e5aa93f9b83de985 Mon Sep 17 00:00:00 2001 From: thororen1234 <78185467+thororen1234@users.noreply.github.com> Date: Thu, 18 Jul 2024 01:08:04 -0400 Subject: [PATCH] catch errors on userpfp & globalbadges --- src/equicordplugins/globalBadges/index.tsx | 3 ++- src/equicordplugins/userpfp/index.tsx | 7 +++++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/equicordplugins/globalBadges/index.tsx b/src/equicordplugins/globalBadges/index.tsx index ca7a28cf..9aeba5bc 100644 --- a/src/equicordplugins/globalBadges/index.tsx +++ b/src/equicordplugins/globalBadges/index.tsx @@ -52,7 +52,8 @@ const fetchBadges = (id: string): BadgeCache["badges"] | undefined => { .then(body => { cache.set(id, { badges: body, expires: Date.now() + EXPIRES }); return body; - }); + }) + .catch(() => null); } else if (cachedValue) { return cachedValue.badges; } diff --git a/src/equicordplugins/userpfp/index.tsx b/src/equicordplugins/userpfp/index.tsx index 2049f0ee..340a2f80 100644 --- a/src/equicordplugins/userpfp/index.tsx +++ b/src/equicordplugins/userpfp/index.tsx @@ -75,7 +75,10 @@ export default definePlugin({ return data.avatars[user.id] ?? original(user, animated, size); }, async start() { - const res = await fetch(settings.store.urlForDB); - if (res.ok) this.data = data = await res.json(); + const res = await fetch(settings.store.urlForDB) + .then(async res => { + if (res.ok) this.data = data = await res.json(); + }) + .catch(() => null); } });