add more logging

This commit is contained in:
Aaron Bieber 2024-04-22 13:58:37 -06:00
parent 12fb99bcf8
commit e34a9e4cd8
No known key found for this signature in database

9
got.go
View File

@ -79,6 +79,7 @@ func gotListen(store *FStore, cli *gomatrix.Client) {
http.HandleFunc("/_got/v2", func(w http.ResponseWriter, r *http.Request) { http.HandleFunc("/_got/v2", func(w http.ResponseWriter, r *http.Request) {
if r.Method != http.MethodPost { if r.Method != http.MethodPost {
log.Printf("GOT: invalid method: '%q'\n", r.Method)
http.Error(w, fmt.Sprintf("method %q not implemented", r.Method), http.StatusMethodNotAllowed) http.Error(w, fmt.Sprintf("method %q not implemented", r.Method), http.StatusMethodNotAllowed)
return return
} }
@ -156,11 +157,9 @@ func gotListen(store *FStore, cli *gomatrix.Client) {
log.Printf("GOT: sending '%s'\n", line) log.Printf("GOT: sending '%s'\n", line)
err = plugins.SendUnescNotice(cli, gotRoom, line) err = plugins.SendUnescNotice(cli, gotRoom, line)
if err != nil { if err != nil {
http.Error( errMsg := fmt.Sprintf("can not send commit info: %s", err)
w, log.Printf("GOT: error sending '%s': %q\n", line, err)
fmt.Sprintf("can not send commit info: %s", err), http.Error(w, errMsg, http.StatusInternalServerError)
http.StatusInternalServerError,
)
return return
} }
} }