Skip to content

Commit

Permalink
more explicit log info for the slack filter
Browse files Browse the repository at this point in the history
Matrix86 committed Oct 13, 2020

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
1 parent 70a2b56 commit 564b718
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions filters/slack.go
Original file line number Diff line number Diff line change
@@ -107,21 +107,21 @@ func (f *Slack) sendMessageBlocks(client *slack.Client, dst string, jsonBlocks s
var jsonArray string
var i interface{}
if err := json.Unmarshal([]byte(jsonBlocks), &i); err != nil {
return fmt.Errorf("sendMessageBlocks: %s", err)
return fmt.Errorf("sendMessageBlocks: unmarshalling: %s", err)
}
if m, ok := i.(map[string]interface{}); ok {
q := m["blocks"]
output, err := json.Marshal(q)
if err != nil {
return fmt.Errorf("sendMessageBlocks: %s", err)
return fmt.Errorf("sendMessageBlocks: marshalling: %s", err)
}
jsonArray = string(output)
}

var blocks slack.Blocks
err := blocks.UnmarshalJSON([]byte(jsonArray))
if err != nil {
return fmt.Errorf("sendMessageBlocks: %s", err)
return fmt.Errorf("sendMessageBlocks: blocks unmarshalling: %s", err)
}

_, _, err = client.PostMessage(dst, slack.MsgOptionBlocks(blocks.BlockSet...))

0 comments on commit 564b718

Please sign in to comment.