mirror of
https://github.com/grafana/grafana.git
synced 2025-02-12 08:35:43 -06:00
Chore: Improve err message for notifications (#18757)
Improve message of notification json error Fix test after change error message
This commit is contained in:
parent
e9c1b8b3f3
commit
f942fecc52
@ -141,7 +141,7 @@ func NewRuleFromDBAlert(ruleDef *models.Alert) (*Rule, error) {
|
||||
} else {
|
||||
uid, err := jsonModel.Get("uid").String()
|
||||
if err != nil {
|
||||
return nil, ValidationError{Reason: "Neither id nor uid is specified, " + err.Error(), DashboardID: model.DashboardID, AlertID: model.ID, PanelID: model.PanelID}
|
||||
return nil, ValidationError{Reason: "Neither id nor uid is specified in 'notifications' block, " + err.Error(), DashboardID: model.DashboardID, AlertID: model.ID, PanelID: model.PanelID}
|
||||
}
|
||||
model.Notifications = append(model.Notifications, uid)
|
||||
}
|
||||
|
@ -179,7 +179,7 @@ func TestAlertRuleModel(t *testing.T) {
|
||||
|
||||
_, err := NewRuleFromDBAlert(alert)
|
||||
So(err, ShouldNotBeNil)
|
||||
So(err.Error(), ShouldEqual, "Alert validation error: Neither id nor uid is specified, type assertion to string failed AlertId: 1 PanelId: 1 DashboardId: 1")
|
||||
So(err.Error(), ShouldEqual, "Alert validation error: Neither id nor uid is specified in 'notifications' block, type assertion to string failed AlertId: 1 PanelId: 1 DashboardId: 1")
|
||||
})
|
||||
})
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user