ensure a response is always sent

This commit is contained in:
Peter Rounce 2022-08-24 15:23:24 +00:00
parent 8c1150468d
commit 8d1d686355
4 changed files with 51 additions and 25 deletions

View file

@ -45,6 +45,7 @@ func new_card_request(w http.ResponseWriter, req *http.Request) {
params_a, ok := req.URL.Query()["a"]
if !ok || len(params_a[0]) < 1 {
log.Debug("a not found")
write_error(w)
return
}
@ -56,6 +57,7 @@ func new_card_request(w http.ResponseWriter, req *http.Request) {
c, err := db_get_new_card(a)
if err != nil {
log.Warn(err)
write_error(w)
return
}
@ -78,6 +80,7 @@ func new_card_request(w http.ResponseWriter, req *http.Request) {
jsonData, err := json.Marshal(response)
if err != nil {
log.Warn(err)
write_error(w)
return
}