ailistener-old

The central Server which transports webhook events from the Dialogflow bot to the local nodes
git clone git://archive.git.mtrnord.blog/OpenHomeAuto/ailistener-old.git
Log | Files | Refs | README | LICENSE

commit dc1bdab948dc0c48e48d9244a49a75ae370fe7db
parent e3a2b59cc2191451e994a0f07e5210aa14a2d432
Author: MTRNord <mtrnord1@gmail.com>
Date:   Sat,  2 Jun 2018 10:52:37 +0200

Return errors also back to console

Diffstat:
MwsListener/server.go | 3+++
1 file changed, 3 insertions(+), 0 deletions(-)

diff --git a/wsListener/server.go b/wsListener/server.go @@ -34,18 +34,21 @@ func DFHandler(w http.ResponseWriter, r *http.Request) { if r.Body == nil { http.Error(w, "Please send a request body", http.StatusNotAcceptable) + log.Println("[WSERROR] request body missing") return } defer r.Body.Close() decoder := json.NewDecoder(r.Body) if err := decoder.Decode(&dfr); err != nil { http.Error(w, err.Error(), http.StatusInternalServerError) + log.Println("[WSERROR] failed to decode: " + err.Error()) return } // Retrieve the params of the request if err := dfr.GetParams(&p); err != nil { http.Error(w, err.Error(), http.StatusInternalServerError) + log.Println("[WSERROR] failed to get parmas: " + err.Error()) return } log.Printf("REQUEST: %+v", dfr.QueryResult)