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

Signed-off-by: bergquist <carl.bergquist@gmail.com>
Co-authored-by: Will Browne <wbrowne@users.noreply.github.com>
This commit is contained in:
Carl Bergquist 2021-03-29 16:03:15 +02:00 committed by GitHub
parent e1458391bb
commit 5ec530f3fc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -240,7 +240,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)
}