fix: return correct error

This commit is contained in:
Paul Makles 2022-05-17 21:10:47 +01:00
parent f8e67af962
commit e74c3a5f80
2 changed files with 6 additions and 2 deletions

2
external/lang vendored

@ -1 +1 @@
Subproject commit fd152393e48ccea8e5e6fdd6bd99fbc343c5b56d Subproject commit 10c4f3be26e25ae4cc4bafc0811f4174236b5c3a

View file

@ -8,6 +8,10 @@ import { Children } from "../../types/Preact";
export function takeError(error: any): string { export function takeError(error: any): string {
if (error.response) { if (error.response) {
const status = error.response.status; const status = error.response.status;
if (error.response.type) {
return error.response.type;
}
switch (status) { switch (status) {
case 429: case 429:
return "TooManyRequests"; return "TooManyRequests";
@ -15,7 +19,7 @@ export function takeError(error: any): string {
case 403: case 403:
return "Unauthorized"; return "Unauthorized";
default: default:
return error.response.type ?? "UnknownError"; return "UnknownError";
} }
} else if (error.request) { } else if (error.request) {
return "NetworkError"; return "NetworkError";