print errors when we can not grok the json

This commit is contained in:
Aaron Bieber 2024-04-22 13:16:36 -06:00
parent 8d6703594b
commit 12fb99bcf8
No known key found for this signature in database

4
got.go
View File

@ -95,13 +95,15 @@ func gotListen(store *FStore, cli *gomatrix.Client) {
dec := json.NewDecoder(r.Body) dec := json.NewDecoder(r.Body)
err = dec.Decode(&gn) err = dec.Decode(&gn)
if err != nil { if err != nil {
http.Error(w, "invalid data sent to server", http.StatusBadRequest) log.Printf("GOT: invalid data sent to server: '%s'\n", err)
http.Error(w, fmt.Sprintf("invalid data sent to server: %s", err), http.StatusBadRequest)
return return
} }
for _, line := range gn.Notifications { for _, line := range gn.Notifications {
log.Printf("GOT: sending '%s'\n", line.String()) log.Printf("GOT: sending '%s'\n", line.String())
err = plugins.SendUnescNotice(cli, gotRoom, line.String()) err = plugins.SendUnescNotice(cli, gotRoom, line.String())
if err != nil { if err != nil {
log.Printf("GOT: error sending commit info: '%s'\n", err)
http.Error( http.Error(
w, w,
fmt.Sprintf("can not send commit info: %s", err), fmt.Sprintf("can not send commit info: %s", err),