raylu 14 жил өмнө
parent
commit
f07e94efd1
1 өөрчлөгдсөн 5 нэмэгдсэн , 5 устгасан
  1. 5 5
      main.go

+ 5 - 5
main.go

@@ -60,7 +60,7 @@ func add(w http.ResponseWriter, r *http.Request) {
 	q := r.URL.Query()
 	pid := getpid(q.Get("pid"))
 	if pid == -1 {
-		http.Error(w, "invalid pid", http.StatusInternalServerError)
+		http.Error(w, "invalid pid", http.StatusBadRequest)
 		return
 	}
 
@@ -84,7 +84,7 @@ func remove(w http.ResponseWriter, r *http.Request) {
 	q := r.URL.Query()
 	pid := getpid(q.Get("pid"))
 	if pid == -1 {
-		http.Error(w, "invalid pid", http.StatusInternalServerError)
+		http.Error(w, "invalid pid", http.StatusBadRequest)
 		return
 	}
 
@@ -104,7 +104,7 @@ func move(w http.ResponseWriter, r *http.Request) {
 	q := r.URL.Query()
 	pid := getpid(q.Get("pid"))
 	if pid == -1 {
-		http.Error(w, "invalid pid", http.StatusInternalServerError)
+		http.Error(w, "invalid pid", http.StatusBadRequest)
 		return
 	}
 
@@ -132,7 +132,7 @@ func move(w http.ResponseWriter, r *http.Request) {
 	} else if direction == moveDownAction {
 		newOrder++
 	} else {
-		http.Error(w, "invalid direction or cannot move up", http.StatusInternalServerError)
+		http.Error(w, "invalid direction or cannot move up", http.StatusBadRequest)
 		return
 	}
 
@@ -144,7 +144,7 @@ func move(w http.ResponseWriter, r *http.Request) {
 		return
 	} else if db.AffectedRows != 1 {
 		db.Rollback()
-		http.Error(w, "invalid direction for this song", http.StatusInternalServerError)
+		http.Error(w, "invalid direction for this song", http.StatusBadRequest)
 		return
 	}
 	// there are now two songs with that order, so also check yid