Skip to content

Commit 1ef7ac8

Browse files
authored
fix(notifications): fix panic when logging failed discord-webhook (#878)
1 parent 647320a commit 1ef7ac8

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

backend/pkg/notification/notifications.go

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1170,13 +1170,14 @@ func sendDiscordNotifications() error {
11701170
}
11711171
errResp.Status = resp.Status
11721172
resp.Body.Close()
1173-
}
11741173

1175-
if resp.StatusCode == http.StatusTooManyRequests {
1176-
log.Warnf("could not push to discord webhook due to rate limit. %v url: %v", errResp.Body, webhook.Url)
1177-
} else {
1178-
log.Error(nil, "error pushing discord webhook", 0, map[string]interface{}{"errResp.Body": errResp.Body, "webhook.Url": webhook.Url})
1174+
if resp.StatusCode == http.StatusTooManyRequests {
1175+
log.Warnf("could not push to discord webhook due to rate limit. %v url: %v", errResp.Body, webhook.Url)
1176+
} else {
1177+
log.Error(nil, "error pushing discord webhook", 0, map[string]interface{}{"errResp.Body": errResp.Body, "webhook.Url": webhook.Url})
1178+
}
11791179
}
1180+
11801181
_, err = db.FrontendWriterDB.Exec(`UPDATE users_webhooks SET request = $2, response = $3 WHERE id = $1;`, webhook.ID, reqs[i].Content.DiscordRequest, errResp)
11811182
if err != nil {
11821183
log.Error(err, "error storing failure data in users_webhooks table", 0)

0 commit comments

Comments
 (0)