summaryrefslogtreecommitdiffstats
path: root/model/incoming_webhook.go
diff options
context:
space:
mode:
authorCorey Hulen <corey@hulen.com>2017-08-18 15:58:26 -0700
committerGitHub <noreply@github.com>2017-08-18 15:58:26 -0700
commit4a8afebcdb8e8c88b4191d68cb1b5712d12cee9c (patch)
treefba1b8f62db029d510fc3513fd8febece8925e27 /model/incoming_webhook.go
parent2b3f7d0bc3c0cd415e9e8f0a1cf0af6e6bac5b8a (diff)
downloadchat-4a8afebcdb8e8c88b4191d68cb1b5712d12cee9c.tar.gz
chat-4a8afebcdb8e8c88b4191d68cb1b5712d12cee9c.tar.bz2
chat-4a8afebcdb8e8c88b4191d68cb1b5712d12cee9c.zip
Adding debugging for webhook (#7199)
* Adding debugging for webhook * Fixing build error * Moving error down
Diffstat (limited to 'model/incoming_webhook.go')
-rw-r--r--model/incoming_webhook.go6
1 files changed, 3 insertions, 3 deletions
diff --git a/model/incoming_webhook.go b/model/incoming_webhook.go
index ce755f889..e8ed6dc82 100644
--- a/model/incoming_webhook.go
+++ b/model/incoming_webhook.go
@@ -193,7 +193,7 @@ func decodeIncomingWebhookRequest(by []byte) (*IncomingWebhookRequest, error) {
}
}
-func IncomingWebhookRequestFromJson(data io.Reader) *IncomingWebhookRequest {
+func IncomingWebhookRequestFromJson(data io.Reader) (*IncomingWebhookRequest, *AppError) {
buf := new(bytes.Buffer)
buf.ReadFrom(data)
by := buf.Bytes()
@@ -204,12 +204,12 @@ func IncomingWebhookRequestFromJson(data io.Reader) *IncomingWebhookRequest {
if err != nil {
o, err = decodeIncomingWebhookRequest(escapeControlCharsFromPayload(by))
if err != nil {
- return nil
+ return nil, NewAppError("IncomingWebhookRequestFromJson", "Unable to parse incoming data", nil, err.Error(), http.StatusBadRequest)
}
}
o.Text = ExpandAnnouncement(o.Text)
o.Attachments = ProcessSlackAttachments(o.Attachments)
- return o
+ return o, nil
}