mirror of
https://github.com/WiiLink24/wfc-server.git
synced 2026-03-21 17:44:58 -05:00
API: Don't panic on error
This commit is contained in:
parent
450d0fc979
commit
fc224859e0
|
|
@ -13,12 +13,14 @@ func HandleGroups(w http.ResponseWriter, r *http.Request) {
|
|||
|
||||
u, err := url.Parse(r.URL.String())
|
||||
if err != nil {
|
||||
panic(err)
|
||||
w.WriteHeader(http.StatusBadRequest)
|
||||
return
|
||||
}
|
||||
|
||||
query, err := url.ParseQuery(u.RawQuery)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
w.WriteHeader(http.StatusBadRequest)
|
||||
return
|
||||
}
|
||||
|
||||
gameName := query.Get("gamename")
|
||||
|
|
@ -42,7 +44,8 @@ func HandleGroups(w http.ResponseWriter, r *http.Request) {
|
|||
|
||||
jsonData, err := json.Marshal(groups)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
w.WriteHeader(http.StatusInternalServerError)
|
||||
return
|
||||
}
|
||||
|
||||
w.Header().Set("Content-Length", strconv.Itoa(len(jsonData)))
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user