DataSource: change status code to 404 if datasource and plugin is not found (#36426)

Fixes #36418
pull/36439/head
Tharun Rajendran 4 years ago committed by GitHub
parent 4932b9dfa4
commit f62bc59688
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 6
      pkg/services/datasourceproxy/datasourceproxy.go

@ -46,6 +46,10 @@ func (p *DatasourceProxyService) ProxyDatasourceRequestWithID(c *models.ReqConte
c.JsonApiErr(http.StatusForbidden, "Access denied to datasource", err)
return
}
if errors.Is(err, models.ErrDataSourceNotFound) {
c.JsonApiErr(http.StatusNotFound, "Unable to find datasource", err)
return
}
c.JsonApiErr(http.StatusInternalServerError, "Unable to load datasource meta data", err)
return
}
@ -59,7 +63,7 @@ func (p *DatasourceProxyService) ProxyDatasourceRequestWithID(c *models.ReqConte
// find plugin
plugin := p.PluginManager.GetDataSource(ds.Type)
if plugin == nil {
c.JsonApiErr(http.StatusInternalServerError, "Unable to find datasource plugin", err)
c.JsonApiErr(http.StatusNotFound, "Unable to find datasource plugin", err)
return
}

Loading…
Cancel
Save