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>
pull/32434/head
Carl Bergquist 4 years ago committed by GitHub
parent e1458391bb
commit 5ec530f3fc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      pkg/api/datasources.go

@ -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)
}

Loading…
Cancel
Save