summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHorus32015-03-30 19:25:13 +0200
committerHorus32015-03-30 19:25:13 +0200
commit49255cff30fb2f588217aefb0fe547ef0fd213fc (patch)
treeb143d9a07582a2f2b14652a30d9011856b68ecb4
parenta6c354692f35fefb4c6821ca15c05ad48a64fc8f (diff)
downloadweb2irc-49255cff30fb2f588217aefb0fe547ef0fd213fc.tar.gz
Fix small bug in error handling.
-rw-r--r--handler.go5
1 files changed, 4 insertions, 1 deletions
diff --git a/handler.go b/handler.go
index ce9f2a7..61564b8 100644
--- a/handler.go
+++ b/handler.go
@@ -28,11 +28,14 @@ func WebhookHandler(w http.ResponseWriter, r *http.Request) {
err := decoder.Decode(&hook)
if err != nil {
+ var body string
content, cError := ioutil.ReadAll(r.Body)
if err != nil {
log.Println("Can't read r.Body.", cError)
+ body = "Message not readable."
+ } else {
+ body = string(content)
}
- body := string(content)
log.Print("Wrong JSON.", err, "Original message: "+body)