Spaces:
Sleeping
Sleeping
Download backend/src/utils/httpError.ts from build-small-hackathon/lovegpt: direct link, hf CLI and curl.
- Browser
- Download file 382 Bytes
-
https://huggingface.co/spaces/build-small-hackathon/lovegpt/resolve/main/backend/src/utils/httpError.ts
- Command line
-
hf download hf://spaces/build-small-hackathon/lovegpt/backend/src/utils/httpError.ts
-
curl -L -o httpError.ts https://huggingface.co/spaces/build-small-hackathon/lovegpt/resolve/main/backend/src/utils/httpError.ts
382 Bytes
| export class HttpError extends Error { | |
| readonly status: number; | |
| readonly code: string; | |
| constructor(status: number, code: string, message: string) { | |
| super(message); | |
| this.status = status; | |
| this.code = code; | |
| } | |
| } | |
| export function getErrorMessage(error: unknown): string { | |
| if (error instanceof Error) { | |
| return error.message; | |
| } | |
| return "Unexpected error"; | |
| } | |