fix: actually resolve the error from requests

This commit is contained in:
Paul Makles 2022-06-07 17:00:11 +01:00
parent 12b9716043
commit 67c8418c31

View file

@ -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: