Skip to content

Commit

Permalink
Merge pull request #107 from wanjunlei/release-1.4
Browse files Browse the repository at this point in the history
fix bug verification does not report error
  • Loading branch information
Benjamin Huo authored Oct 12, 2021
2 parents db71d84 + ea3b658 commit 9b7b7d9
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
9 changes: 7 additions & 2 deletions pkg/notify/notifier/dingtalk/dingtalk.go
Original file line number Diff line number Diff line change
Expand Up @@ -349,7 +349,7 @@ func (n *Notifier) sendToChatBot(ctx context.Context, d *config.DingTalk, data t
}

if res.Status != 0 {
_ = level.Error(n.logger).Log("msg", "DingTalkNotifier: send message to chatbot error", "name", "status", res.Status, "punish", res.Punish)
_ = level.Error(n.logger).Log("msg", "DingTalkNotifier: send message to chatbot error", "status", res.Status, "punish", res.Punish)
return fmt.Errorf("send message to chatbot error, status %d, punish %s", res.Status, res.Punish)
}

Expand Down Expand Up @@ -495,7 +495,12 @@ func (n *Notifier) sendToConversation(ctx context.Context, d *config.DingTalk, d

if res.Code != 0 {
_ = level.Error(n.logger).Log("msg", "DingTalkNotifier: send message to conversation error", "conversation", chatID, "errcode", res.Code, "errmsg", res.Message)
return err
return fmt.Errorf("send message to conversation '%s' error, errcode %d, errmsg %s", chatID, res.Code, res.Message)
}

if res.Status != 0 {
_ = level.Error(n.logger).Log("msg", "DingTalkNotifier: send message to conversation error", "conversation", chatID, "status", res.Status, "punish", res.Punish)
return fmt.Errorf("send message to conversation '%s' error, status %d, punish %s", chatID, res.Status, res.Punish)
}

_ = level.Debug(n.logger).Log("msg", "DingTalkNotifier: send message to conversation", "conversation", chatID)
Expand Down
2 changes: 1 addition & 1 deletion pkg/notify/notifier/wechat/wechat.go
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,7 @@ func (n *Notifier) Notify(ctx context.Context, data template.Data) []error {
"toUser", utils.ArrayToString(w.ToUser, "|"),
"toParty", utils.ArrayToString(w.ToParty, "|"),
"toTag", utils.ArrayToString(w.ToTag, "|"))
return false, nil
return false, fmt.Errorf("%s", weResp.ErrorMsg)
}

retry, err := sendMessage()
Expand Down

0 comments on commit 9b7b7d9

Please sign in to comment.