From 971fa01d4078aff0103f60b433f2159d2416e4a4 Mon Sep 17 00:00:00 2001 From: Haruka <96925398+nakoyasha@users.noreply.github.com> Date: Wed, 1 Nov 2023 03:23:45 +0200 Subject: [PATCH] EmoteCloner: make the error toasts useful (#1938) Co-authored-by: Vendicated --- src/plugins/emoteCloner/index.tsx | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/plugins/emoteCloner/index.tsx b/src/plugins/emoteCloner/index.tsx index c44731152..219ce435f 100644 --- a/src/plugins/emoteCloner/index.tsx +++ b/src/plugins/emoteCloner/index.tsx @@ -155,10 +155,15 @@ async function doClone(guildId: string, data: Sticker | Emoji) { type: Toasts.Type.SUCCESS, id: Toasts.genId() }); - } catch (e) { + } catch (e: any) { + let message = "Something went wrong (check console!)"; + try { + message = JSON.parse(e.text).message; + } catch { } + new Logger("EmoteCloner").error("Failed to clone", data.name, "to", guildId, e); Toasts.show({ - message: "Oopsie something went wrong :( Check console!!!", + message: "Failed to clone: " + message, type: Toasts.Type.FAILURE, id: Toasts.genId() });