Browse Source

alerting: handle invalid json format

closes #11003
bergquist 7 years ago
parent
commit
93e1546f73
1 changed files with 4 additions and 1 deletions
  1. 4 1
      pkg/services/alerting/notifiers/dingding.go

+ 4 - 1
pkg/services/alerting/notifiers/dingding.go

@@ -72,7 +72,10 @@ func (this *DingDingNotifier) Notify(evalContext *alerting.EvalContext) error {
 		this.log.Error("Failed to create Json data", "error", err, "dingding", this.Name)
 		this.log.Error("Failed to create Json data", "error", err, "dingding", this.Name)
 	}
 	}
 
 
-	body, _ := bodyJSON.MarshalJSON()
+	body, err := bodyJSON.MarshalJSON()
+	if err != nil {
+		return err
+	}
 
 
 	cmd := &m.SendWebhookSync{
 	cmd := &m.SendWebhookSync{
 		Url:  this.Url,
 		Url:  this.Url,