Spaces:
Paused
Paused
Download client/src/utils/apiError.ts from Leon4gr45/augmenttoolkit: direct link, hf CLI and curl.
- Browser
- Download file 517 Bytes
-
https://huggingface.co/spaces/Leon4gr45/augmenttoolkit/resolve/bb4da7e5d448e08c0375f8cfd152cb4fdc024f92/client/src/utils/apiError.ts
- Command line
-
hf download hf://spaces/Leon4gr45/augmenttoolkit@bb4da7e5d448e08c0375f8cfd152cb4fdc024f92/client/src/utils/apiError.ts
-
curl -L -o apiError.ts https://huggingface.co/spaces/Leon4gr45/augmenttoolkit/resolve/bb4da7e5d448e08c0375f8cfd152cb4fdc024f92/client/src/utils/apiError.ts
517 Bytes
| /** | |
| * Pulls the server-provided error string out of an axios-style error so the UI can | |
| * surface the real reason (e.g. a Google Places API message such as "Places API (New) | |
| * has not been used in project … or it is disabled") instead of a generic fallback. | |
| */ | |
| export function getApiErrorMessage(err: unknown, fallback: string): string { | |
| const message = (err as { response?: { data?: { error?: unknown } } })?.response?.data?.error | |
| return typeof message === 'string' && message.trim() ? message : fallback | |
| } | |