Download internal/httpapi/admin/shared/request_error.go from a3216/ds2api: direct link, hf CLI and curl.
- Browser
- Download file 549 Bytes
-
https://huggingface.co/spaces/a3216/ds2api/resolve/ce5a019598af8a3a8fa70d3880098df3e850ecd7/internal/httpapi/admin/shared/request_error.go
- Command line
-
hf download hf://spaces/a3216/ds2api@ce5a019598af8a3a8fa70d3880098df3e850ecd7/internal/httpapi/admin/shared/request_error.go
-
curl -L -o request_error.go https://huggingface.co/spaces/a3216/ds2api/resolve/ce5a019598af8a3a8fa70d3880098df3e850ecd7/internal/httpapi/admin/shared/request_error.go
549 Bytes
| package shared | |
| import "errors" | |
| type requestError struct { | |
| detail string | |
| } | |
| func (e *requestError) Error() string { | |
| return e.detail | |
| } | |
| func newRequestError(detail string) error { | |
| return &requestError{detail: detail} | |
| } | |
| func NewRequestError(detail string) error { | |
| return newRequestError(detail) | |
| } | |
| func requestErrorDetail(err error) (string, bool) { | |
| var reqErr *requestError | |
| if errors.As(err, &reqErr) { | |
| return reqErr.detail, true | |
| } | |
| return "", false | |
| } | |
| func RequestErrorDetail(err error) (string, bool) { | |
| return requestErrorDetail(err) | |
| } | |