mirror of
https://github.com/revoltchat/revite.git
synced 2024-11-21 22:50:59 -05:00
fix: return correct error
This commit is contained in:
parent
f8e67af962
commit
e74c3a5f80
2 changed files with 6 additions and 2 deletions
2
external/lang
vendored
2
external/lang
vendored
|
@ -1 +1 @@
|
|||
Subproject commit fd152393e48ccea8e5e6fdd6bd99fbc343c5b56d
|
||||
Subproject commit 10c4f3be26e25ae4cc4bafc0811f4174236b5c3a
|
|
@ -8,6 +8,10 @@ import { Children } from "../../types/Preact";
|
|||
export function takeError(error: any): string {
|
||||
if (error.response) {
|
||||
const status = error.response.status;
|
||||
if (error.response.type) {
|
||||
return error.response.type;
|
||||
}
|
||||
|
||||
switch (status) {
|
||||
case 429:
|
||||
return "TooManyRequests";
|
||||
|
@ -15,7 +19,7 @@ export function takeError(error: any): string {
|
|||
case 403:
|
||||
return "Unauthorized";
|
||||
default:
|
||||
return error.response.type ?? "UnknownError";
|
||||
return "UnknownError";
|
||||
}
|
||||
} else if (error.request) {
|
||||
return "NetworkError";
|
||||
|
|
Loading…
Reference in a new issue