mirror of
https://github.com/grafana/grafana.git
synced 2025-02-16 18:34:52 -06:00
Org update should throw error if not found (#7066)
* Org update should give error if not found * Used affected rows
This commit is contained in:
parent
d8ebebc612
commit
65057212e7
@ -133,10 +133,16 @@ func UpdateOrg(cmd *m.UpdateOrgCommand) error {
|
|||||||
Updated: time.Now(),
|
Updated: time.Now(),
|
||||||
}
|
}
|
||||||
|
|
||||||
if _, err := sess.Id(cmd.OrgId).Update(&org); err != nil {
|
affectedRows, err := sess.Id(cmd.OrgId).Update(&org)
|
||||||
|
|
||||||
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if affectedRows == 0 {
|
||||||
|
return m.ErrOrgNotFound
|
||||||
|
}
|
||||||
|
|
||||||
sess.publishAfterCommit(&events.OrgUpdated{
|
sess.publishAfterCommit(&events.OrgUpdated{
|
||||||
Timestamp: org.Updated,
|
Timestamp: org.Updated,
|
||||||
Id: org.Id,
|
Id: org.Id,
|
||||||
|
Loading…
Reference in New Issue
Block a user