From f32de541a4206cf00d943b90b91d1290b5a35acc Mon Sep 17 00:00:00 2001 From: Howl Date: Thu, 9 Jun 2016 10:52:55 +0200 Subject: [PATCH] Fix set_status 500 ing when beatmap is not found by ID --- app/v1/beatmap.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/app/v1/beatmap.go b/app/v1/beatmap.go index 22fb9db..a95b77a 100644 --- a/app/v1/beatmap.go +++ b/app/v1/beatmap.go @@ -98,7 +98,10 @@ func BeatmapSetStatusPOST(md common.MethodData) common.CodeMessager { param := req.BeatmapsetID if req.BeatmapID != 0 { err := md.DB.QueryRow("SELECT beatmapset_id FROM beatmaps WHERE beatmap_id = ? LIMIT 1", req.BeatmapID).Scan(¶m) - if err != nil { + switch { + case err == sql.ErrNoRows: + return common.SimpleResponse(404, "That beatmap could not be found!") + case err != nil: md.Err(err) return Err500 }