(w http.ResponseWriter, status int, message string)
| 613 | } |
| 614 | |
| 615 | func writeJSONError(w http.ResponseWriter, status int, message string) { |
| 616 | w.Header().Set("Content-Type", "application/json") |
| 617 | w.WriteHeader(status) |
| 618 | |
| 619 | err := json.NewEncoder(w).Encode(map[string]string{"error": message}) |
| 620 | if err != nil { |
| 621 | log.Error().Err(err).Int("status", status).Msg("Failed to encode JSON error response") |
| 622 | if _, writeErr := io.WriteString(w, "error\n"); writeErr != nil { |
| 623 | log.Error().Err(writeErr).Int("status", status).Msg("Failed to write JSON error fallback response") |
| 624 | } |
| 625 | } |
| 626 | } |
| 627 | |
| 628 | type proxyMediaInfoRequestError struct { |
| 629 | status int |
no test coverage detected