Fix error videos

This commit is contained in:
Ben Sarmiento
2023-11-07 01:17:23 +01:00
parent 6be49d8843
commit 568a9a9b70
5 changed files with 36 additions and 32 deletions

View File

@@ -42,13 +42,13 @@ func HandlePropfindRequest(w http.ResponseWriter, r *http.Request, t *torrent.To
output, err = handleSingleTorrent(requestPath, w, r, t)
default:
log.Errorf("Request %s %s not found", r.Method, requestPath)
writeHTTPError(w, "Not Found", http.StatusNotFound)
http.Error(w, "Not Found", http.StatusNotFound)
return
}
if err != nil {
log.Errorf("Error processing request: %v", err)
writeHTTPError(w, "Server error", http.StatusInternalServerError)
http.Error(w, "Server error", http.StatusInternalServerError)
return
}
@@ -107,7 +107,3 @@ func handleSingleTorrent(requestPath string, w http.ResponseWriter, r *http.Requ
}
return xml.Marshal(resp)
}
func writeHTTPError(w http.ResponseWriter, errorMessage string, statusCode int) {
http.Error(w, errorMessage, statusCode)
}