fix: return correct error
parent
3cbf6e1d1f
commit
acc446dc60
|
|
@ -1 +1 @@
|
||||||
Subproject commit fd152393e48ccea8e5e6fdd6bd99fbc343c5b56d
|
Subproject commit 10c4f3be26e25ae4cc4bafc0811f4174236b5c3a
|
||||||
|
|
@ -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";
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue