API: Return 409 on datasource version conflict (#32425) (#32433)

Signed-off-by: bergquist <carl.bergquist@gmail.com>
Co-authored-by: Will Browne <wbrowne@users.noreply.github.com>
(cherry picked from commit 5ec530f3fc)

Co-authored-by: Carl Bergquist <carl.bergquist@gmail.com>
This commit is contained in:
Grot (@grafanabot)
2021-03-29 16:46:36 +02:00
committed by GitHub
co-authored by Carl Bergquist
parent b0314c0818
commit 270660eaa8
+1 -1
View File
@@ -241,7 +241,7 @@ func UpdateDataSource(c *models.ReqContext, cmd models.UpdateDataSourceCommand)
err = bus.Dispatch(&cmd)
if err != nil {
if errors.Is(err, models.ErrDataSourceUpdatingOldVersion) {
return response.Error(500, "Failed to update datasource. Reload new version and try again", err)
return response.Error(409, "Datasource has already been updated by someone else. Please reload and try again", err)
}
return response.Error(500, "Failed to update datasource", err)
}