Add logging of microsub errors
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
parent
33e58ebe9e
commit
21f1048bba
|
@ -69,6 +69,7 @@ func (h *microsubHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
||||||
if action == "channels" {
|
if action == "channels" {
|
||||||
channels, err := h.backend.ChannelsGetList()
|
channels, err := h.backend.ChannelsGetList()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
log.Println(err)
|
||||||
http.Error(w, err.Error(), 500)
|
http.Error(w, err.Error(), 500)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -78,6 +79,7 @@ func (h *microsubHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
||||||
} else if action == "timeline" {
|
} else if action == "timeline" {
|
||||||
timeline, err := h.backend.TimelineGet(values.Get("before"), values.Get("after"), values.Get("channel"))
|
timeline, err := h.backend.TimelineGet(values.Get("before"), values.Get("after"), values.Get("channel"))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
log.Println(err)
|
||||||
http.Error(w, err.Error(), 500)
|
http.Error(w, err.Error(), 500)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -85,6 +87,7 @@ func (h *microsubHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
||||||
} else if action == "preview" {
|
} else if action == "preview" {
|
||||||
timeline, err := h.backend.PreviewURL(values.Get("url"))
|
timeline, err := h.backend.PreviewURL(values.Get("url"))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
log.Println(err)
|
||||||
http.Error(w, err.Error(), 500)
|
http.Error(w, err.Error(), 500)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -93,6 +96,7 @@ func (h *microsubHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
||||||
channel := values.Get("channel")
|
channel := values.Get("channel")
|
||||||
following, err := h.backend.FollowGetList(channel)
|
following, err := h.backend.FollowGetList(channel)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
log.Println(err)
|
||||||
http.Error(w, err.Error(), 500)
|
http.Error(w, err.Error(), 500)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -102,6 +106,7 @@ func (h *microsubHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
||||||
} else if action == "events" {
|
} else if action == "events" {
|
||||||
events, err := h.backend.Events()
|
events, err := h.backend.Events()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
log.Println(err)
|
||||||
http.Error(w, "could not start sse connection", 500)
|
http.Error(w, "could not start sse connection", 500)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -141,6 +146,7 @@ func (h *microsubHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
||||||
if method == "delete" {
|
if method == "delete" {
|
||||||
err := h.backend.ChannelsDelete(uid)
|
err := h.backend.ChannelsDelete(uid)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
log.Println(err)
|
||||||
http.Error(w, err.Error(), 500)
|
http.Error(w, err.Error(), 500)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -151,6 +157,7 @@ func (h *microsubHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
||||||
if uid == "" {
|
if uid == "" {
|
||||||
channel, err := h.backend.ChannelsCreate(name)
|
channel, err := h.backend.ChannelsCreate(name)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
log.Println(err)
|
||||||
http.Error(w, err.Error(), 500)
|
http.Error(w, err.Error(), 500)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -158,6 +165,7 @@ func (h *microsubHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
||||||
} else if name != "" {
|
} else if name != "" {
|
||||||
channel, err := h.backend.ChannelsUpdate(uid, name)
|
channel, err := h.backend.ChannelsUpdate(uid, name)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
log.Println(err)
|
||||||
http.Error(w, err.Error(), 500)
|
http.Error(w, err.Error(), 500)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user