Refactor handleAdminDiscordLink function for improved error handling and logging

This commit is contained in:
Frederico Santos 2024-09-02 02:06:42 +01:00
parent 3ccc000646
commit 856ad7aac9

View File

@ -669,6 +669,12 @@ func handleProviderLogout(w http.ResponseWriter, r *http.Request) {
}
func handleAdminDiscordLink(w http.ResponseWriter, r *http.Request) {
err := r.ParseForm()
if err != nil {
httpError(w, r, fmt.Errorf("failed to parse request form: %s", err), http.StatusBadRequest)
return
}
uuid, err := uuidFromRequest(r)
if err != nil {
httpError(w, r, err, http.StatusUnauthorized)