(w http.ResponseWriter, err error)
| 836 | } |
| 837 | |
| 838 | func writeNodeError(w http.ResponseWriter, err error) { |
| 839 | status := http.StatusUnprocessableEntity // 422,不被 Cloudflare 拦截 |
| 840 | if errors.Is(err, nodes.ErrNodeNotFound) { |
| 841 | status = http.StatusNotFound |
| 842 | } |
| 843 | writeJSON(w, status, map[string]any{"error": err.Error()}) |
| 844 | } |
| 845 | |
| 846 | func writeMethodNotAllowed(w http.ResponseWriter, allow string) { |
| 847 | w.Header().Set("Allow", allow) |
no test coverage detected