API: Datasource endpoint should return 400 bad request if id and orgId is invalid (#32392)

* return 400 bad request if id and orgId is invalid

Signed-off-by: bergquist <carl.bergquist@gmail.com>
Co-authored-by: Arve Knudsen <arve.knudsen@gmail.com>
This commit is contained in:
Carl Bergquist
2021-03-29 08:56:58 +02:00
committed by GitHub
parent a4b0ad3937
commit eb241b960f

View File

@@ -71,6 +71,9 @@ func GetDataSourceById(c *models.ReqContext) response.Response {
if errors.Is(err, models.ErrDataSourceNotFound) {
return response.Error(404, "Data source not found", nil)
}
if errors.Is(err, models.ErrDataSourceIdentifierNotSet) {
return response.Error(400, "Datasource id is missing", nil)
}
return response.Error(500, "Failed to query datasources", err)
}