diff --git a/components/AppealCard.tsx b/components/AppealCard.tsx index 75b6803..02b248e 100644 --- a/components/AppealCard.tsx +++ b/components/AppealCard.tsx @@ -62,9 +62,16 @@ export default function (props: AppealCardProps) { document.getElementById(`appeal_${props.id}`)?.remove(); } else { + let error; + + try { + error = ((await actionReq.json()) as { error: string }).error; + } catch { + error = "Unknown error"; + } setLoading(false); toast({ - description: ((await actionReq.json()) as { error: string }).error, + description: error, duration: 10000, status: "error", title: "Oops!", diff --git a/functions/gcloud.ts b/functions/gcloud.ts index 5de325b..1809acd 100644 --- a/functions/gcloud.ts +++ b/functions/gcloud.ts @@ -296,5 +296,5 @@ export async function sendPushNotification( }, ); - if (!notifResp.ok) throw new Error(await notifResp.json()); + if (!notifResp.ok) throw new Error(await notifResp.text()); }