mirror of
https://github.com/woodchen-ink/certimate.git
synced 2025-07-18 09:21:56 +08:00
feat(ui): make request error friendly
This commit is contained in:
parent
0a90523d61
commit
4883b3bb88
@ -2,7 +2,7 @@ import { ClientResponseError } from "pocketbase";
|
||||
|
||||
export const getErrMsg = (error: unknown): string => {
|
||||
if (error instanceof ClientResponseError) {
|
||||
return error.response != null ? getErrMsg(error.response) : error.message;
|
||||
return Object.keys(error.response ?? {}).length ? getErrMsg(error.response) : error.message;
|
||||
} else if (error instanceof Error) {
|
||||
return error.message;
|
||||
} else if (typeof error === "object" && error != null) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user