From f07e94efd1453070103776c4002a11467e8b235e Mon Sep 17 00:00:00 2001 From: raylu Date: Sun, 7 Aug 2011 18:51:55 -0700 Subject: HTTP 500 -> 400 --- main.go | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/main.go b/main.go index c5023f6..b10de22 100644 --- a/main.go +++ b/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 -- cgit v1.2.3