From 67c8418c31a661bda82cb3ff728a80bd8dfcb7d4 Mon Sep 17 00:00:00 2001 From: Paul Makles Date: Tue, 7 Jun 2022 17:00:11 +0100 Subject: [PATCH] fix: actually resolve the error from requests --- src/context/revoltjs/util.tsx | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/context/revoltjs/util.tsx b/src/context/revoltjs/util.tsx index 106fefe9..878cc50e 100644 --- a/src/context/revoltjs/util.tsx +++ b/src/context/revoltjs/util.tsx @@ -7,12 +7,12 @@ import { Children } from "../../types/Preact"; // eslint-disable-next-line @typescript-eslint/no-explicit-any export function takeError(error: any): string { if (error.response) { - const status = error.response.status; - if (error.response.type) { - return error.response.type; + const type = error.response.data?.type; + if (type) { + return type; } - switch (status) { + switch (error.response.status) { case 429: return "TooManyRequests"; case 401: