mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Alerting: Return proper status code when trying to create alert notification channel with duplicate name or uid (#28043)
* Alerting: Return proper status code when trying to create an Alert Notification where the name or UID already exists. Co-authored-by: Arve Knudsen <arve.knudsen@gmail.com> Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>
This commit is contained in:
@@ -299,7 +299,7 @@ func CreateAlertNotificationCommand(cmd *models.CreateAlertNotificationCommand)
|
||||
}
|
||||
|
||||
if existingQuery.Result != nil {
|
||||
return fmt.Errorf("Alert notification uid %s already exists", cmd.Uid)
|
||||
return models.ErrAlertNotificationWithSameUIDExists
|
||||
}
|
||||
|
||||
// check if name exists
|
||||
@@ -309,7 +309,7 @@ func CreateAlertNotificationCommand(cmd *models.CreateAlertNotificationCommand)
|
||||
}
|
||||
|
||||
if sameNameQuery.Result != nil {
|
||||
return fmt.Errorf("Alert notification name %s already exists", cmd.Name)
|
||||
return models.ErrAlertNotificationWithSameNameExists
|
||||
}
|
||||
|
||||
var frequency time.Duration
|
||||
|
||||
Reference in New Issue
Block a user