Add some logging
Some checks failed
continuous-integration/drone/push Build is failing

This commit is contained in:
Peter Stuifzand 2019-03-18 22:11:28 +01:00
parent d75e55ec49
commit d58d21d491

View File

@ -175,7 +175,8 @@ func (handler *subscriptionHandler) handleSubscription(w http.ResponseWriter, r
if validateURL(validationURL.String(), ourChallenge) {
log.Printf("subscribe: validation valid\n")
_ = handler.store.Subscribe(topicURL.String(), storage.Subscriber{callbackURL.String(), leaseSeconds, secret, time.Now()})
err = handler.store.Subscribe(topicURL.String(), storage.Subscriber{callbackURL.String(), leaseSeconds, secret, time.Now()})
log.Println("saving suscriber failed: %v", err)
} else {
log.Printf("subscribe: validation failed\n")
}
@ -224,13 +225,16 @@ func (handler *subscriptionHandler) ServeHTTP(w http.ResponseWriter, r *http.Req
if mode == "subscribe" {
err = handler.handleSubscription(w, r)
log.Println("saving subscribe failed: %v", err)
return
} else if mode == "unsubscribe" {
err = handler.handleUnsubscription(w, r)
log.Println("saving unsubscribe failed: %v", err)
return
} else if mode == "publish" {
log.Println("hub.mode=publish received")
err = handler.handlePublish(w, r)
log.Println("handling publish failed: %v", err)
return
} else {
http.Error(w, "Unknown hub.mode", 400)