Download internal/httpapi/claude/handler_errors.go from a3216/ds2api: direct link, hf CLI and curl.
- Browser
- Download file 575 Bytes
-
https://huggingface.co/spaces/a3216/ds2api/resolve/ce5a019598af8a3a8fa70d3880098df3e850ecd7/internal/httpapi/claude/handler_errors.go
- Command line
-
hf download hf://spaces/a3216/ds2api@ce5a019598af8a3a8fa70d3880098df3e850ecd7/internal/httpapi/claude/handler_errors.go
-
curl -L -o handler_errors.go https://huggingface.co/spaces/a3216/ds2api/resolve/ce5a019598af8a3a8fa70d3880098df3e850ecd7/internal/httpapi/claude/handler_errors.go
575 Bytes
| package claude | |
| import "net/http" | |
| func writeClaudeError(w http.ResponseWriter, status int, message string) { | |
| code := "invalid_request" | |
| switch status { | |
| case http.StatusUnauthorized: | |
| code = "authentication_failed" | |
| case http.StatusTooManyRequests: | |
| code = "rate_limit_exceeded" | |
| case http.StatusNotFound: | |
| code = "not_found" | |
| case http.StatusInternalServerError: | |
| code = "internal_error" | |
| } | |
| writeJSON(w, status, map[string]any{ | |
| "error": map[string]any{ | |
| "type": "invalid_request_error", | |
| "message": message, | |
| "code": code, | |
| "param": nil, | |
| }, | |
| }) | |
| } | |